コード例 #1
0
ファイル: test_time.py プロジェクト: neurodata/ndstore
    def test_time_diff(self):
        """Post npz data with default channel"""

        p.args = (3000, 3100, 2000, 2100, 10, 11, 2, 3)
        image_data1 = np.ones([2, 1, 1, 100, 100],
                              dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data1, time=True)
        assert (response.status_code == 200)
        voxarray = getNPZ(p, time=True)
        # check that the return matches
        assert (np.array_equal(voxarray, image_data1))

        p.args = (3000, 3100, 2000, 2100, 10, 11, 3, 4)
        image_data2 = np.ones([2, 1, 1, 100, 100],
                              dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data2, time=True)
        assert (response.status_code == 200)
        voxarray = getNPZ(p, time=True)
        # check that the return matches
        assert (np.array_equal(voxarray, image_data2))

        p.args = (3000, 3100, 2000, 2100, 10, 11, 2, 4)
        url = "https://{}/sd/{}/{}/diff/{}/{},{}/{},{}/{},{}/{},{}/".format(
            SITE_HOST, p.token, p.channels[0], p.resolution, *p.args)
        f = getURL(url)
        voxarray = blosc.unpack_array(f.content)

        image_data = np.subtract(np.float32(image_data1),
                                 np.float32(image_data2))
        assert (np.array_equal(image_data[0, :], voxarray[0, :]))
コード例 #2
0
ファイル: test_propagate.py プロジェクト: neurodata/ndstore
    def test_web_propagate(self):
        """Test the web update propogate function"""

        # Posting some data at res0 to propagate
        p.args = (200, 300, 200, 300, 32, 64, 9, 10)
        image_data = np.ones([1, 1, 32, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        if KV_ENGINE == REDIS:
            response = postNPZ(p, image_data, time=True, direct=True)
        else:
            response = postNPZ(p, image_data, time=True)

        # Check if the project is not proagated
        f = getURL("https://{}/sd/{}/{}/getPropagate/".format(
            SITE_HOST, p.token, ','.join(p.channels)))
        value = int(f.content)
        assert (value == NOT_PROPAGATED)

        # Start propagating
        f = getURL("https://{}/sd/{}/{}/setPropagate/{}/".format(
            SITE_HOST, p.token, ','.join(p.channels), UNDER_PROPAGATION))

        # Checking if the PROPGATED value is set correctly
        for iter_value in range(1, 500, 1):
            time.sleep(1)
            f = getURL("https://{}/sd/{}/{}/getPropagate/".format(
                SITE_HOST, p.token, ','.join(p.channels)))
            value = int(f.content)
            if value == PROPAGATED:
                break
        assert (value == PROPAGATED)

        # Checking at res1
        p.args = (100, 150, 100, 150, 16, 32, 9, 10)
        p.resolution = 1
        voxarray = getNPZ(p, time=True)
        assert (np.array_equal(voxarray[0][0][0],
                               image_data[0][0][0][:50, :50]))

        # Checking at res2
        p.args = (50, 75, 50, 75, 8, 16, 9, 10)
        p.resolution = 2
        voxarray = getNPZ(p, time=True)
        assert (np.array_equal(voxarray[0][0][0],
                               image_data[0][0][0][:25, :25]))

        # Checking at res3
        p.args = (25, 37, 25, 37, 4, 8, 9, 10)
        p.resolution = 3
        voxarray = getNPZ(p, time=True)
        assert (np.array_equal(voxarray[0][0][0],
                               image_data[0][0][0][:12, :12]))
コード例 #3
0
  def test_npz_incorrect_channel (self):
    """Post npz data with incorrect channel"""

    p.channels = p.channels + ['IMAGE3']
    image_data = np.ones ( [3,2,10,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data, time=True)
    assert (response.code == 404)
コード例 #4
0
    def test_npz_incorrect_region(self):
        """Post npz to incorrect region"""

        p.args = (11000, 11100, 4000, 4100, 500, 510)
        time_data = np.ones([2, 10, 100, 100],
                            dtype=np.float32) * random.random()
        response = postNPZ(p, time_data)
コード例 #5
0
    def test_neuron(self):
        """Make a multiple segments that overlap and then query them as a neuron"""

        # create neuron
        makeAnno(p, 5)
        neuronid = p.annoid

        # create annotations
        for i in range(0, 3):

            # create annotations
            makeAnno(p, 4)
            f = setField(p, 'neuron', neuronid)

            # add data
            p.args = (3000, 3100, 4000, 4100, 100 + 2 * i, 100 + 2 * i + 3)
            image_data = np.ones([1, 3, 100, 100], dtype=np.uint32) * p.annoid
            response = postNPZ(p, image_data)

        # get the neuron annotation
        p.annoid = neuronid
        p.field = 'tight_cutout'
        h5ret = getAnnotation(p)
        idgrp = h5ret.get(str(p.annoid))

        # count the voxels to make sure they remapped correctly
        assert (np.unique(np.array(idgrp['CUTOUT'][:, :, :])) == [0, neuronid
                                                                  ]).all()
        assert (len(np.nonzero(np.array(
            idgrp['CUTOUT'][:, :, :]))[0]) == 70000)
コード例 #6
0
ファイル: test_stats.py プロジェクト: neurodata/ndstore
    def setup_class(self):
        """Create the unittest database"""
        makeunitdb.createTestDB(p.token,
                                p.channels,
                                channel_type=IMAGE,
                                channel_datatype=UINT8,
                                public=True,
                                ximagesize=1024,
                                yimagesize=1024,
                                zimagesize=20,
                                xvoxelres=1.0,
                                yvoxelres=1.0,
                                zvoxelres=10.0,
                                readonly=0)

        # modify params args to match new data size
        p.args = (0, 1024, 0, 1024, 1, 21)

        # post some sample image data
        self.image_data = np.random.randint(0,
                                            high=255,
                                            size=[1, 20, 1024,
                                                  1024]).astype(np.uint8)
        response = postNPZ(p, self.image_data)

        assert (response.code == 200)

        voxarray = getNPZ(p)
        # check that the return data matches
        assert (np.array_equal(voxarray, self.image_data))
コード例 #7
0
ファイル: test_propagate.py プロジェクト: neurodata/ndstore
    def test_web_propagate(self):
        """Test the web update propogate function"""

        p.resolution = 0
        # Posting some data at res0 to propagate
        p.args = (200, 300, 200, 300, 4, 5)
        image_data = np.ones([1, 1, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data)
        # check that it cannot post to a readonly channle
        assert (response.status_code == 404)

        # Check if the project is not proagated
        f = getURL("https://{}/sd/{}/{}/getPropagate/".format(
            SITE_HOST, p.token, ','.join(p.channels)))
        value = int(f.content)
        assert (value == NOT_PROPAGATED)

        # check that it cannot start propagating a readonly channel
        assert (getURL("https://{}/sd/{}/{}/setPropagate/{}/".format(
            SITE_HOST, p.token, ','.join(p.channels),
            UNDER_PROPAGATION)).status_code == 404)
        # check that it cannot mark a channel as propagated
        assert (getURL("https://{}/sd/{}/{}/setPropagate/{}/".format(
            SITE_HOST, p.token, ','.join(p.channels),
            PROPAGATED)).status_code == 404)
コード例 #8
0
ファイル: test_neuron.py プロジェクト: neurodata/ndstore
  def test_neuron (self):
    """Make a multiple segments that overlap and then query them as a neuron"""

    # create neuron
    makeAnno(p,5)
    neuronid = p.annoid

    # create annotations
    for i in range(0,3):

      # create annotations
      makeAnno(p,4)
      f = setField(p,'neuron',neuronid)

      # add data
      p.args = (3000,3100,4000,4100,100+2*i,100+2*i+3)
      image_data = np.ones( [1,3,100,100], dtype=np.uint32 ) * p.annoid
      response = postNPZ(p, image_data)

    # get the neuron annotation
    p.annoid = neuronid
    p.field = 'tight_cutout'
    h5ret = getAnnotation(p)
    idgrp = h5ret.get(str(p.annoid))

    # count the voxels to make sure they remapped correctly
    assert ( np.unique(np.array(idgrp['CUTOUT'][:,:,:])) == [0,neuronid] ).all()
    assert ( len(np.nonzero(np.array(idgrp['CUTOUT'][:,:,:]))[0]) == 70000 )
コード例 #9
0
  def test_web_propagate(self):
    """Test the web update propogate function"""

    # Posting some data at res0 to propagate
    p.args = (200,300,200,300,4,5)
    image_data = np.ones( [1,1,100,100], dtype=np.uint8) * random.randint(0,255)
    response = postNPZ(p, image_data)

    # Check if the project is not proagated
    f = getURL("http://{}/ca/{}/{}/getPropagate/".format(SITE_HOST, p.token, ','.join(p.channels)))
    value = int(f.read())
    assert(value == NOT_PROPAGATED)

    # Start propagating
    f = getURL("http://{}/ca/{}/{}/setPropagate/{}/".format(SITE_HOST, p.token, ','.join(p.channels), UNDER_PROPAGATION))
    time.sleep(10)
    # Checking if the PROPGATED value is set correctly
    f = getURL("http://{}/ca/{}/{}/getPropagate/".format(SITE_HOST, p.token, ','.join(p.channels)))
    value = int(f.read())
    assert(value == PROPAGATED)
    
    # Checking at res1
    p.args = (100,150,100,150,4,5)
    url = "http://{}/ca/{}/{}/xy/{}/{},{}/{},{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution+1, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4])
    f = getURL(url)
    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data, image_data[0][0][:50,:50]) )
   
    # Checking at res5
    p.args = (7,9,7,9,4,5)
    url = "http://{}/ca/{}/{}/xy/{}/{},{}/{},{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution+5, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4])
    f = getURL(url)
    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data, image_data[0][0][:2,:2]) )
コード例 #10
0
ファイル: test_probability.py プロジェクト: j6k4m8/ndstore
  def test_npz_incorrect_channel (self):
    """Post npz data with incorrect channel"""

    p.channels = p.channels + ['CHAN3']
    image_data = np.ones ( [3,10,100,100], dtype=np.float32 ) * random.random()
    response = postNPZ(p, image_data)
    assert (response.code == 404)
コード例 #11
0
ファイル: test_image.py プロジェクト: neurodata/ndstore
  def test_npz_incorrect_region (self):
    """Post npz to incorrect region"""

    p.args = (11000,11100,4000,4100,500,510)
    image_data = np.ones ( [2,10,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)
    assert (response.status_code == 404)
コード例 #12
0
ファイル: test_annoid.py プロジェクト: neurodata/ndstore
  def test_get_anno_by_loc(self):
    """Test the annotation (RAMON) JSON interface"""

    image_data = np.random.randint(0, high=255, size=[1, 10, 1024, 1024]).astype(np.uint32)
    response = postNPZ(p, image_data)

    assert( response.status_code == 200 )

    voxarray = getNPZ(p)
    # check that the return data matches
    assert( np.array_equal(voxarray, image_data) )

    # query for an ID at res0
    res = 0
    x = 50
    y = 50
    z = 5
    cutout = '{}/{}/{}/{}/'.format( res, x, y, z )
    url = 'https://{}/sd/{}/{}/id/{}'.format( SITE_HOST, p.token, p.channels[0], cutout )

    try:
      # Build a get request
      response = getURL(url)
    except Exception as e:
      print e

    assert( response.status_code == 200 )

    response_id = int(response.content)

    # the offset for this dataset is set to 1, hence z-1
    assert( response_id == image_data[0, z-1, y, x] )
コード例 #13
0
    def test_web_propagate(self):
        """Test the web update propogate function"""

        # Posting some data at res0 to propagate
        p.args = (200, 300, 200, 300, 4, 5)
        image_data = np.ones([1, 1, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data)

        # Check if the project is not proagated
        f = getURL("http://{}/ca/{}/{}/getPropagate/".format(
            SITE_HOST, p.token, ','.join(p.channels)))
        value = int(f.read())
        assert (value == PROPAGATED)

        # check that it cannot start propagating a channel which is already propagated
        assert (getURL("http://{}/ca/{}/{}/setPropagate/{}/".format(
            SITE_HOST, p.token, ','.join(p.channels),
            UNDER_PROPAGATION)) == 404)
        f = getURL("http://{}/ca/{}/{}/setPropagate/{}/".format(
            SITE_HOST, p.token, ','.join(p.channels), NOT_PROPAGATED))
        # can set to not propagated
        f = getURL("http://{}/ca/{}/{}/getPropagate/".format(
            SITE_HOST, p.token, ','.join(p.channels)))
        value = int(f.read())
        assert (value == NOT_PROPAGATED)
コード例 #14
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_npz_incorrect_channel (self):
    """Post npz data with incorrect channel"""

    p.channels = p.channels + ['IMAGE3']
    image_data = np.ones ( [3,10,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)
    assert (response.code == 404)
コード例 #15
0
    def test_npz_incorrect_region(self):
        """Post npz to incorrect region"""

        p.args = (11000, 11100, 4000, 4100, 500, 510)
        image_data = np.ones([2, 10, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data)
コード例 #16
0
    def test_npz_incorrect_channel(self):
        """Post npz data with incorrect channel"""

        p.channels = p.channels + ['CHAN3']
        time_data = np.ones([3, 10, 100, 100],
                            dtype=np.float32) * random.random()
        response = postNPZ(p, time_data)
        assert (response.status_code == 404)
コード例 #17
0
ファイル: test_propagate.py プロジェクト: neurodata/ndstore
    def test_web_propagate(self):
        """Test the web update propogate function"""

        # Posting some data at res0 to propagate
        p.args = (200, 300, 200, 300, 32, 64)
        p.resolution = 0
        image_data = np.ones([1, 32, 100, 100],
                             dtype=np.uint32) * random.randint(255, 65535)
        response = postNPZ(p, image_data)

        voxarray = getNPZ(p)
        # check that the return matches
        assert (np.array_equal(voxarray, image_data))

        # Check if the project is not proagated
        f = getURL("https://{}/sd/{}/{}/getPropagate/".format(
            SITE_HOST, p.token, ','.join(p.channels)))
        value = int(f.content)
        assert (value == NOT_PROPAGATED)

        # Start propagating
        f = getURL("https://{}/sd/{}/{}/setPropagate/{}/".format(
            SITE_HOST, p.token, ','.join(p.channels), UNDER_PROPAGATION))

        # Checking if the PROPGATED value is set correctly
        for iter_value in range(1, 100, 1):
            time.sleep(1)
            f = getURL("https://{}/sd/{}/{}/getPropagate/".format(
                SITE_HOST, p.token, ','.join(p.channels)))
            value = int(f.content)
            if value == PROPAGATED:
                break
        assert (value == PROPAGATED)

        # Checking at res1
        p.args = (100, 150, 100, 150, 16, 32)
        p.resolution = 1
        voxarray = getNPZ(p)
        assert (np.array_equal(voxarray[0][0], image_data[0][0][:50, :50]))

        # Checking at res2
        p.args = (50, 75, 50, 75, 8, 16)
        p.resolution = 2
        voxarray = getNPZ(p)
        assert (np.array_equal(voxarray[0][0], image_data[0][0][:25, :25]))

        # Checking at res3
        p.args = (25, 37, 25, 37, 4, 8)
        p.resolution = 3
        voxarray = getNPZ(p)
        assert (np.array_equal(voxarray[0][0], image_data[0][0][:12, :12]))

        # Checking at res4
        p.args = (13, 19, 13, 19, 2, 4)
        p.resolution = 4
        voxarray = getNPZ(p)
        assert (np.array_equal(voxarray[0][0], image_data[0][0][:6, :6]))
コード例 #18
0
  def test_npz_incorrect_timesize (self):
    """Post npz data with incorrect time size"""

    p.args = (8000,9000,2000,3000,410,420,15,20)
    # upload some image data
    image_data = np.ones ( [2,7,10,100,100], dtype=np.uint16 ) * random.randint(0,255)

    response = postNPZ(p, image_data, time=True)
    assert (response.code == 404)
コード例 #19
0
ファイル: test_blosc.py プロジェクト: j6k4m8/ndstore
  def test_get_blosc (self):
    """Test the xy slice cutout"""

    p.args = (3000,3100,4000,4100,200,201)
    image_data = np.ones( [2,1,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)
    posted_data = getBlosc(p)

    assert ( np.array_equal(image_data,posted_data) )
コード例 #20
0
ファイル: test_raw.py プロジェクト: neurodata/ndstore
    def test_get_raw(self):
        """Test the xyz cube cutout for raw data"""

        p.args = (3000, 3003, 4000, 4003, 200, 203, 50, 60)
        image_data = (np.random.rand(2, 10, 3, 3, 3) * 255).astype(np.uint8)
        response = postNPZ(p, image_data, time=True)
        requested_data = getRAW(p, time=True)
        requested_data.shape = (2, 10, 3, 3, 3)
        assert (np.array_equal(image_data, requested_data))
コード例 #21
0
ファイル: test_probability.py プロジェクト: j6k4m8/ndstore
  def test_npz_incorrect_datatype (self):
    """Post npz data with incorrect datatype"""

    p.args = (4000,4100,5000,5100,500,510)
    # upload some image data
    image_data = np.ones ( [2,10,100,100], dtype=np.float64 ) * random.random()

    response = postNPZ(p, image_data)
    assert (response.code == 404)
コード例 #22
0
  def test_npz_incorrect_datatype (self):
    """Post npz data with incorrect datatype"""

    p.args = (4000,4100,5000,5100,500,510,11,18)
    # upload some image data
    image_data = np.ones ( [2,7,10,100,100], dtype=np.uint16 ) * random.randint(0,255)

    response = postNPZ(p, image_data, time=True)
    assert (response.code == 404)
コード例 #23
0
ファイル: test_stats.py プロジェクト: neurodata/ndstore
  def test_genhistogram (self):
    """Test generating an 8bit histogram"""

    image_data = np.random.randint(0, high=255, size=[1, 10, 1024, 1024]).astype(np.uint8)
    response = postNPZ(p, image_data)

    assert( response.status_code == 200 )

    voxarray = getNPZ(p)
    # check that the return data matches
    assert( np.array_equal(voxarray, image_data) )

    # generate the histogram
    url = 'https://{}/stats/{}/{}/genhist/'.format( SITE_HOST, p.token, p.channels[0] )
    try:
      # Build a get request
      response = getURL(url)
    except Exception as e:
      print e

    assert( response.status_code == 200 )

    jsonresponse = json.loads(response.content)

    # make sure the celery job started
    celerystatus = celery_app.AsyncResult(jsonresponse['jobid'])

    # wait for histogram generation to finish (either 10 mins or failure)
    # note: actual generation time should be more like 0.2 seconds, but there may be other jobs in the queue
    count = 0
    while celerystatus.state != 'SUCCESS':
      time.sleep(1)
      celerystatus = celery_app.AsyncResult(jsonresponse['jobid'])
      assert( celerystatus.state != 'FAILURE' )
      assert( count != 60 )
      count += 1

    # now get the histogram
    url = 'https://{}/stats/{}/{}/hist/'.format( SITE_HOST, p.token, p.channels[0] )
    try:
      # Build a get request
      response = getURL(url)
    except Exception as e:
      print e

    assert( response.status_code == 200 )

    jsonresponse = json.loads(response.content)

    # now see if the two histograms are equivalent
    testhist = np.histogram(image_data[image_data > 0], bins=256, range=(0,256))

    # check to see that the bins are equal
    assert( np.array_equal( jsonresponse['bins'], testhist[1] ) )

    # check to see that the counts are equal
    assert( np.array_equal( jsonresponse['hist'], testhist[0] ) )
コード例 #24
0
ファイル: test_raw.py プロジェクト: neurodata/ndstore
    def test_get_direct_neariso_raw(self):
        """Test the xyz cube cutout direct for raw data"""

        p.args = (400, 403, 200, 203, 10, 15, 7, 9)
        image_data = (np.random.rand(2, 2, 5, 3, 3) * 255).astype(np.uint8)
        response = postNPZ(p, image_data, time=True, neariso=True, direct=True)
        requested_data = getRAW(p, time=True, neariso=True)
        requested_data.shape = (2, 2, 5, 3, 3)
        assert (np.array_equal(image_data, requested_data))
コード例 #25
0
    def test_get_blosc(self):
        """Test the xy slice cutout"""

        p.args = (3000, 3100, 4000, 4100, 200, 201)
        image_data = np.ones([2, 1, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data)
        posted_data = getBlosc(p)

        assert (np.array_equal(image_data, posted_data))
コード例 #26
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_npz_default_channel (self):
    """Post npz data with default channel"""

    image_data = np.ones ( [1,10,100,100], dtype=np.uint8 ) * random.randint(0,255)
    p.channels = None
    response = postNPZ(p, image_data)
    assert (response.code == 200)
    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray,image_data) )
コード例 #27
0
    def test_npz_incorrect_datatype(self):
        """Post npz data with incorrect datatype"""

        p.args = (4000, 4100, 5000, 5100, 500, 510)
        # upload some image data
        time_data = np.ones([2, 10, 100, 100],
                            dtype=np.float64) * random.random()

        response = postNPZ(p, time_data)
        assert (response.status_code == 404)
コード例 #28
0
    def test_npz_default_channel(self):
        """Post npz data with default channel"""

        image_data = np.ones([1, 10, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        p.channels = None
        response = postNPZ(p, image_data)
        assert (response.code == 200)
        voxarray = getNPZ(p)
        # check that the return matches
        assert (np.array_equal(voxarray, image_data))
コード例 #29
0
ファイル: test_image.py プロジェクト: neurodata/ndstore
  def test_xy (self):
    """Test the xy slice cutout"""

    p.args = (3000,3100,4000,4100,200,201)
    image_data = np.ones( [2,1,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)

    url = "https://{}/sd/{}/{}/xy/{}/{},{}/{},{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4])
    f = getURL (url)

    slice_data = np.asarray ( Image.open(StringIO(f.content)) )
    assert ( np.array_equal(slice_data,image_data[0][0]) )
コード例 #30
0
  def test_xy (self):
    """Test the xy slice cutout"""

    p.args = (3000,3100,4000,4100,200,201,10,12)
    time_data = np.ones( [2,2,1,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, time_data, time=True)

    url = "http://{}/ca/{}/{}/xy/{}/{},{}/{},{}/{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4], p.args[6])
    f = getURL (url)

    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data, time_data[0][0][0]) )
コード例 #31
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_xz (self):
    """Test the xz slice cutout"""

    p.args = (5000,5100,2000,2001,200,300)
    image_data = np.ones( [2,100,1,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)

    url = "http://{}/ca/{}/{}/xz/{}/{},{}/{}/{},{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[4], p.args[5])
    f = getURL (url)

    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data, image_data[0][:75][:].reshape(75,100)) )
コード例 #32
0
    def test_create_json(self):
        """Test the basic JSON project creation with only the required fields"""

        p.channels = ['CHAN1', 'CHAN2']
        # dataset format = (dataset_name, [ximagesz, yimagesz, zimagesz], [[xvoxel, yvoxel, zvoxel], [xoffset, yoffset, zoffset], timerange, scalinglevels, scaling)
        dataset = (p.dataset, [2000, 2000,
                               1000], [1.0, 1.0, 5.0], None, None, None, None)
        # project format = (project_name, token_name, public)
        project = (p.token, None, None)
        # channel format = { chan1 : (channel_name, datatype, channel_type, data_url, file_name, exceptions, resolution, windowrange, readonly), chan2: ...... }
        channels = {
            p.channels[0]:
            (p.channels[0], p.datatype, p.channel_type, 'sample_data_url',
             'sample_filename', 'tif', None, None, None, 0),
            p.channels[1]:
            (p.channels[1], p.datatype, p.channel_type, 'sample_data_url',
             'sample_filename', 'tif', None, None, None, 0),
        }

        json_file = tempfile.NamedTemporaryFile(mode='w+b')
        json_file.write(
            createJson(dataset, project, channels, channel_only=True))
        json_file.seek(0)

        # posting the JSON url and checking if it is successful
        response = json.loads(
            postURL(
                "http://{}/ca/{}/createChannel/".format(SITE_HOST, p.token),
                json_file).read())
        assert (
            'SUCCESS. The information in the channel was correct.' == response)

        # fetching the JSON info
        f = getURL("http://{}/ca/{}/info/".format(SITE_HOST, p.token))

        # read the JSON file
        proj_info = json.loads(f.read())
        assert (proj_info['project']['name'] == p.token)
        assert (proj_info['dataset']['imagesize']['0'] == [2000, 2000, 1000])
        assert (proj_info['dataset']['cube_dimension']['0'] == [128, 128, 16])
        assert (proj_info['dataset']['scalinglevels'] == 5)
        assert (proj_info['channels'][p.channels[0]]['resolution'] == 0)
        assert (proj_info['channels'][p.channels[0]]['channel_type'] ==
                p.channel_type)
        assert (proj_info['channels'][p.channels[1]]['datatype'] == p.datatype)

        # Testing if the it allows data to be posted to the created channels
        p.args = (1000, 1100, 500, 600, 200, 201)
        image_data = np.ones([2, 1, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, image_data)
        voxarray = getNPZ(p)
        assert (np.array_equal(image_data, voxarray))
コード例 #33
0
ファイル: test_raw.py プロジェクト: neurodata/ndstore
    def test_get_direct_raw(self):
        """Test the xyz cube cutout direct for raw data"""

        p.args = (1000, 1003, 2000, 2003, 100, 103, 10, 12)
        # p.args = (512, 1024, 0, 512, 1, 65)
        image_data = (np.random.rand(2, 2, 3, 3, 3) * 255).astype(np.uint8)
        # image_data = (np.random.rand(2, 64, 512, 512) * 255).astype(np.uint8)
        response = postNPZ(p, image_data, time=True, direct=True)
        requested_data = getRAW(p, time=True)
        requested_data.shape = (2, 2, 3, 3, 3)
        # requested_data.shape = (2,64,512,512)
        assert (np.array_equal(image_data, requested_data))
コード例 #34
0
  def test_yz (self):
    """Test the yz slice cutout"""

    p.args = (4000,4001,3000,3100,200,300,10,11)
    image_data = np.ones( [2,1,100,100,1], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data, time=True)

    url = "http://{}/ca/{}/{}/yz/{}/{}/{},{}/{},{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[2], p.args[3], p.args[4], p.args[5], p.args[6])
    f = getURL (url)

    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data, image_data[0][0][:75][:].reshape(75,100)) )
コード例 #35
0
  def test_npz (self):
    """Post npz data to correct region with correct datatype"""

    p.args = (3000,3100,4000,4100,500,510,20,24)
    # upload some image data
    image_data = np.ones ( [2,4,10,100,100], dtype=np.uint8 ) * random.randint(0,255)
    
    response = postNPZ(p, image_data, time=True)
    # Checking for successful post
    assert( response.code == 200 )
    voxarray = getNPZ(p, time=True)
    # check that the return matches
    assert ( np.array_equal(voxarray,image_data) )
コード例 #36
0
ファイル: test_probability.py プロジェクト: j6k4m8/ndstore
  def test_npz (self):
    """Post npz data to correct region with correct datatype"""

    p.args = (3000,3100,4000,4100,500,510)
    # upload some image data
    image_data = np.ones ( [2,10,100,100], dtype=np.float32 ) * random.random()
    
    response = postNPZ(p, image_data)
    # Checking for successful post
    assert( response.code == 200 )
    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray,image_data) )
コード例 #37
0
ファイル: test_probability.py プロジェクト: j6k4m8/ndstore
  def test_yz (self):
    """Test the yz slice cutout"""

    p.args = (4000,4001,3000,3100,200,300)
    image_data = np.ones( [2,100,100,1], dtype=np.float32 ) * random.random()
    response = postNPZ(p, image_data)

    url = "http://{}/ca/{}/{}/yz/{}/{}/{},{}/{},{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[2], p.args[3], p.args[4], p.args[5])
    f = getURL (url)

    image_data = np.uint8(image_data*256)
    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data[:,:,0], image_data[0][:75][:].reshape(75,100)) )
コード例 #38
0
ファイル: test_jpeg.py プロジェクト: j6k4m8/ndstore
  def test_get_jpeg (self):
    """Test the jpeg volume cutout"""

    p.args = (3000,3100,4000,4100,200,210)
    image_data = np.ones( [2,10,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)
    
    url = "http://{}/ca/{}/{}/jpeg/{}/{},{}/{},{}/{},{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4], p.args[5])
    data = getURL(url).read()
    posted_data = np.asarray( Image.open(cStringIO.StringIO(data)) )

    image_data = image_data[0,:,:,:].reshape(1000,100)
    assert ( np.array_equal(image_data,posted_data) )
コード例 #39
0
  def test_window_default(self):
    "Test the window functionality"

    p.args = (3000,3100,4000,4100,200,201,50,52)
    image_data = np.ones([2,2,1,100,100], dtype=np.uint16) * 2000
    response = postNPZ(p, image_data, time=True)

    url = "http://{}/ca/{}/{}/xy/{}/{},{}/{},{}/{}/{}".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4], p.args[6])
    f = getURL (url)

    from windowcutout import windowCutout
    windowCutout(image_data, p.window)
    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data,image_data[0][0][0]) )
コード例 #40
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_xy_tile(self):
    """Test a mcfc xy tile fetch"""

    p.args = (3072,3584,4096,4608,200,201)
    # have to use a constant here for memcache purposes
    image_data = np.ones([2,1,512,512], dtype=np.uint8) * 200
    response = postNPZ(p, image_data)
    
    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray, image_data) )
    
    url = "http://{}/catmaid/mcfc/{}/{}/xy/{}/{}_{}_{}.png".format(SITE_HOST, p.token, ','.join(p.channels), p.args[4], p.args[2]/512, p.args[0]/512, p.resolution)
    f = getURL (url)
コード例 #41
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_window_default(self):
    "Test the window functionality"

    p.args = (3000,3100,4000,4100,200,201)
    image_data = np.ones([2,1,100,100], dtype=np.uint16) * 2000
    response = postNPZ(p, image_data)

    url = "http://{}/ca/{}/{}/xy/{}/{},{}/{},{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4])
    f = getURL (url)

    from windowcutout import windowCutout
    windowCutout(image_data, p.window)
    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data,image_data[0][0]) )
コード例 #42
0
  def test_web_propagate(self):
    """Test the web update propogate function"""
    
    # Posting some data at res0 to propagate
    p.args = (200,300,200,300,32,64)
    p.resolution=0
    image_data = np.ones( [1,32,100,100], dtype=np.uint32) * random.randint(255,65535)
    response = postNPZ(p, image_data)

    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray,image_data) )

    # Check if the project is not proagated
    f = getURL("http://{}/ca/{}/{}/getPropagate/".format(SITE_HOST, p.token, ','.join(p.channels)))
    value = int(f.read())
    assert(value == NOT_PROPAGATED)

    # Start propagating
    f = getURL("http://{}/ca/{}/{}/setPropagate/{}/".format(SITE_HOST, p.token, ','.join(p.channels), UNDER_PROPAGATION))

    # Checking if the PROPGATED value is set correctly
    time.sleep(30)
    f = getURL("http://{}/ca/{}/{}/getPropagate/".format(SITE_HOST, p.token, ','.join(p.channels)))
    value = int(f.read())
    assert(value == PROPAGATED)

    # Checking at res1
    p.args = (100,150,100,150,16,32)
    p.resolution = 1
    voxarray = getNPZ(p)
    assert ( np.array_equal(voxarray[0][0], image_data[0][0][:50,:50]) )

    # Checking at res2
    p.args = (50,75,50,75,8,16)
    p.resolution = 2
    voxarray = getNPZ(p)
    assert ( np.array_equal(voxarray[0][0], image_data[0][0][:25,:25]) )
    
    # Checking at res3
    p.args = (25,37,25,37,4,8)
    p.resolution = 3
    voxarray = getNPZ(p)
    assert ( np.array_equal(voxarray[0][0], image_data[0][0][:12,:12]) )

    # Checking at res4
    p.args = (13,19,13,19,2,4)
    p.resolution = 4
    voxarray = getNPZ(p)
    assert ( np.array_equal(voxarray[0][0], image_data[0][0][:6,:6]) )
コード例 #43
0
    def test_npz(self):
        """Post npz data to correct region with correct datatype"""

        p.args = (3000, 3100, 4000, 4100, 500, 510)
        # upload some image data
        time_data = np.ones([2, 10, 100, 100],
                            dtype=np.float32) * random.random()

        response = postNPZ(p, time_data)
        # Checking for successful post
        assert (response.status_code == 200)
        voxarray = getNPZ(p)
        # check that the return matches
        assert (np.array_equal(voxarray, time_data))
コード例 #44
0
ファイル: test_image.py プロジェクト: neurodata/ndstore
  def test_window_args(self):
    "Test the window functionality"

    p.args = (3000,3100,4000,4100,200,201)
    p.window = [0,1500]
    image_data = np.ones([2,1,100,100], dtype=np.uint16) * 2000
    response = postNPZ(p, image_data)

    url = "https://{}/sd/{}/{}/xy/{}/{},{}/{},{}/{}/window/{},{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4], *p.window)
    f = getURL (url)

    from ndlib.windowcutout import windowCutout
    image_data = windowCutout(image_data, p.window).astype(np.uint8)
    slice_data = np.asarray ( Image.open(StringIO(f.content)) )
    assert ( np.array_equal(slice_data,image_data[0][0]) )
コード例 #45
0
ファイル: test_probability.py プロジェクト: neurodata/ndstore
  def test_xz (self):
    """Test the xz slice cutout"""

    p.args = (5000,5100,2000,2001,200,300,10,12)
    time_data = np.ones( [2,2,100,1,100], dtype=np.float32 ) * random.random()
    response = postNPZ(p, time_data, time=True)

    url = "https://{}/sd/{}/{}/xz/{}/{},{}/{}/{},{}/{}/".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0], p.args[1], p.args[2], p.args[4], p.args[5], p.args[6])
    f = getURL (url)

    from ndlib.windowcutout import windowCutout
    time_data = windowCutout(time_data, p.window).astype(np.uint8)
    # time_data = np.uint8(time_data*256)
    slice_data = np.asarray ( Image.open(StringIO(f.content)) )
    assert ( np.array_equal(slice_data, time_data[0][0][:75][:].reshape(75,100)) )
コード例 #46
0
ファイル: test_time.py プロジェクト: neurodata/ndstore
    def test_direct_neariso_npz(self):
        """Post npz data to correct region with correct datatype"""

        p.resolution = 2
        p.args = (1000, 1100, 500, 600, 100, 110, 10, 14)
        # upload some image data
        image_data = np.ones([2, 4, 10, 100, 100],
                             dtype=np.uint8) * random.randint(0, 255)

        response = postNPZ(p, image_data, time=True, neariso=True, direct=True)
        # Checking for successful post
        assert (response.status_code == 200)
        voxarray = getNPZ(p, time=True, neariso=True)
        # check that the return matches
        assert (np.array_equal(voxarray, image_data))
コード例 #47
0
    def test_xy_tile(self):
        """Test a mcfc xy tile fetch"""

        p.args = (3072, 3584, 4096, 4608, 200, 201)
        # have to use a constant here for memcache purposes
        image_data = np.ones([2, 1, 512, 512], dtype=np.uint8) * 200
        response = postNPZ(p, image_data)

        voxarray = getNPZ(p)
        # check that the return matches
        assert (np.array_equal(voxarray, image_data))

        url = "http://{}/catmaid/mcfc/{}/{}/xy/{}/{}_{}_{}.png".format(
            SITE_HOST, p.token, ','.join(p.channels), p.args[4],
            p.args[2] / 512, p.args[0] / 512, p.resolution)
        f = getURL(url)
コード例 #48
0
    def test_xy(self):
        """Test the xy slice cutout"""

        p.args = (3000, 3100, 4000, 4100, 200, 201)
        image_data = np.ones([2, 1, 100, 100],
                             dtype=np.float32) * random.random()
        response = postNPZ(p, image_data)

        url = "http://{}/ca/{}/{}/xy/{}/{},{}/{},{}/{}/".format(
            SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0],
            p.args[1], p.args[2], p.args[3], p.args[4])
        f = getURL(url)

        image_data = np.uint8(image_data * 256)
        slice_data = np.asarray(Image.open(StringIO(f.read())))
        assert (np.array_equal(slice_data[:, :, 0], image_data[0][0]))
コード例 #49
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_xy_default_channel (self):
    """Test the xy slice cutout"""

    p.args = (3000,3100,4000,4100,200,201)
    image_data = np.ones( [1,1,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)
    assert (response.code == 200)
    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray,image_data) )

    url = "http://{}/ca/{}/xy/{}/{},{}/{},{}/{}/".format(SITE_HOST, p.token, p.resolution, p.args[0], p.args[1], p.args[2], p.args[3], p.args[4])
    f = getURL (url)

    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data,image_data[0][0]) )
コード例 #50
0
ファイル: test_time.py プロジェクト: neurodata/ndstore
    def test_xy_neariso_zoom_in(self):
        """Test the xy slice cutout"""

        p.resolution = 3
        p.args = (1000, 1100, 500, 600, 10, 11, 10, 12)
        time_data = np.ones([2, 2, 1, 100, 100],
                            dtype=np.uint8) * random.randint(0, 255)
        response = postNPZ(p, time_data, time=True, neariso=True, direct=False)
        assert (response.status_code == 200)

        p.resolution = 0
        p.args = (8000, 8800, 4000, 4800, 30, 31, 10, 12)
        url = "https://{}/sd/{}/{}/xy/{}/{},{}/{},{}/{}/{}/".format(
            SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0],
            p.args[1], p.args[2], p.args[3], p.args[4], p.args[6])
        response = getURL(url)
コード例 #51
0
ファイル: test_stats.py プロジェクト: neurodata/ndstore
  def setup_class(self):
    """Create the unittest database"""
    makeunitdb.createTestDB(p.token, p.channels, channel_type=IMAGE, channel_datatype=UINT8, public=True, ximagesize=1024, yimagesize=1024, zimagesize=20, xvoxelres=1.0, yvoxelres=1.0, zvoxelres=10.0, readonly=0)

    # modify params args to match new data size
    p.args = (0,1024,0,1024,1,21)

    # post some sample image data
    self.image_data = np.random.randint(0, high=255, size=[1, 20, 1024, 1024]).astype(np.uint8)
    response = postNPZ(p, self.image_data)

    assert( response.code == 200 )

    voxarray = getNPZ(p)
    # check that the return data matches
    assert( np.array_equal(voxarray, self.image_data) )
コード例 #52
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
 def test_xy_tile(self):
   """Test a simple xy tile fetch"""
  
   p.args = (1536,2048,4096,4608,200,201)
   # have to use a constant here for memcache purposes
   image_data = np.ones([2,1,512,512], dtype=np.uint8) * 130
   response = postNPZ(p, image_data)
   
   voxarray = getNPZ(p)
   # check that the return matches
   assert ( np.array_equal(voxarray, image_data) )
   
   url = "http://{}/catmaid/viking/{}/volume/{}/{}/X{}_Y{}_Z{}.png".format(SITE_HOST, p.token, p.channels[0], p.resolution, p.args[0]/512, p.args[2]/512, p.args[4])
   f = getURL (url)
   
   slice_data = np.asarray ( Image.open(StringIO(f.read())) )
   assert ( np.array_equal(slice_data, image_data[0][0]) )
コード例 #53
0
ファイル: test_image.py プロジェクト: j6k4m8/ndstore
  def test_xz_tile (self):
    """Test a simple xz slice fetch"""

    p.args = (3072,3584,4096,4097,1,513)
    # have to use a constant here for memcache purposes
    image_data = np.ones([2,512,1,512], dtype=np.uint8) * 130
    response = postNPZ(p, image_data)
    
    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray, image_data) )

    url = "http://{}/catmaid/{}/{}/xz/{}/{}_{}_{}.png".format(SITE_HOST, p.token, p.channels[0], p.args[4]/512, p.args[2], p.args[0]/512, p.resolution)
    f = getURL (url)

    scale_range = 512*p.voxel[2]/p.voxel[0]
    slice_data = np.asarray ( Image.open(StringIO(f.read())) )
    assert ( np.array_equal(slice_data[:scale_range,:], image_data[0,:scale_range,0,:]) )
コード例 #54
0
ファイル: test_image.py プロジェクト: neurodata/ndstore
  def test_yz_tile (self):
    """Test a simple yz slice fetch"""

    p.args = (8072,8073,4096,4608,1,513)
    # have to use a constant here for memcache purposes
    image_data = np.ones([2,512,512,1], dtype=np.uint8) * 130
    response = postNPZ(p, image_data)

    voxarray = getNPZ(p)
    # check that the return matches
    assert ( np.array_equal(voxarray, image_data) )

    # yz/x/z_y_res
    url = "https://{}/catmaid/{}/{}/yz/{}/{}_{}_{}.png".format(SITE_HOST, p.token, p.channels[0], p.args[0], p.args[4]/512, p.args[2]/512, p.resolution)
    f = getURL (url)
    
    scale_range = int(512*p.voxel[2]/p.voxel[1])
    slice_data = np.asarray ( Image.open(StringIO(f.content)) )
    assert ( np.array_equal(slice_data[:scale_range,:], image_data[0,:scale_range,:,0] ))
コード例 #55
0
  def test_web_propagate(self):
    """Test the web update propogate function"""

    # Posting some data at res0 to propagate
    p.args = (200,300,200,300,4,5)
    image_data = np.ones( [1,1,100,100], dtype=np.uint8) * random.randint(0,255)
    response = postNPZ(p, image_data)
    # check that it cannot post to a readonly channle
    assert(response.code == 404)

    # Check if the project is not proagated
    f = getURL("http://{}/ca/{}/{}/getPropagate/".format(SITE_HOST, p.token, ','.join(p.channels)))
    value = int(f.read())
    assert(value == NOT_PROPAGATED)
    
    # check that it cannot start propagating a readonly channel
    assert (getURL("http://{}/ca/{}/{}/setPropagate/{}/".format(SITE_HOST, p.token, ','.join(p.channels), UNDER_PROPAGATION)) == 404 )
    # check that it cannot mark a channel as propagated
    assert (getURL("http://{}/ca/{}/{}/setPropagate/{}/".format(SITE_HOST, p.token, ','.join(p.channels), PROPAGATED)) == 404 )
コード例 #56
0
ファイル: test_stats.py プロジェクト: j6k4m8/ndstore
  def test_genhistogram (self):
    """Test generating an 8bit histogram"""

    image_data = np.random.randint(0, high=255, size=[1, 10, 1024, 1024]).astype(np.uint8)
    response = postNPZ(p, image_data)

    assert( response.code == 200 )

    voxarray = getNPZ(p)
    # check that the return data matches
    assert( np.array_equal(voxarray, image_data) )

    # generate the histogram 
    url = 'http://{}/stats/{}/{}/genhist/'.format( SITE_HOST, p.token, p.channels[0] )
    try:
      # Build a get request
      req = urllib2.Request(url)
      response = urllib2.urlopen(req)
    except urllib2.HTTPError,e:
      return e
コード例 #57
0
ファイル: test_json.py プロジェクト: nagyistge/ndstore
  def test_create_json(self):
    """Test the basic JSON project creation with only the required fields"""
    
    p.channels = ['CHAN1', 'CHAN2'] 
    # dataset format = (dataset_name, [ximagesz, yimagesz, zimagesz], [[xvoxel, yvoxel, zvoxel], [xoffset, yoffset, zoffset], timerange, scalinglevels, scaling)
    dataset = (p.dataset, [2000,2000,1000], [1.0,1.0,5.0], None, None, None, None)
    # project format = (project_name, token_name, public)
    project = (p.token, None, None)
    # channel format = { chan1 : (channel_name, datatype, channel_type, data_url, file_name, exceptions, resolution, windowrange, readonly), chan2: ...... }
    channels = { p.channels[0] : (p.channels[0], p.datatype, p.channel_type, 'sample_data_url', 'sample_filename', 'tif', None, None, None, 0), p.channels[1] : (p.channels[1], p.datatype, p.channel_type, 'sample_data_url', 'sample_filename', 'tif', None, None, None, 0),  }

    json_file = tempfile.NamedTemporaryFile(mode='w+b')
    json_file.write(createJson(dataset, project, channels, channel_only=True))
    json_file.seek(0)

    # posting the JSON url and checking if it is successful
    response = json.loads(postURL("http://{}/ca/{}/createChannel/".format(SITE_HOST, p.token), json_file).read())
    assert('SUCCESS. The information in the channel was correct.' == response)

    # fetching the JSON info
    f = getURL("http://{}/ca/{}/info/".format(SITE_HOST, p.token))

    # read the JSON file
    proj_info = json.loads(f.read())
    assert( proj_info['project']['name'] == p.token )
    assert( proj_info['dataset']['imagesize']['0'] == [2000,2000,1000])
    assert( proj_info['dataset']['cube_dimension']['0'] == [128,128,16])
    assert( proj_info['dataset']['scalinglevels'] == 5)
    assert( proj_info['channels'][p.channels[0]]['resolution'] == 0)
    assert( proj_info['channels'][p.channels[0]]['channel_type'] == p.channel_type)
    assert( proj_info['channels'][p.channels[1]]['datatype'] == p.datatype)
    
    # Testing if the it allows data to be posted to the created channels
    p.args = (1000,1100,500,600,200,201)
    image_data = np.ones( [2,1,100,100], dtype=np.uint8 ) * random.randint(0,255)
    response = postNPZ(p, image_data)
    voxarray = getNPZ(p)
    assert( np.array_equal(image_data, voxarray) )