How to use ndlib - 10 common examples

To help you get started, we’ve selected a few ndlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neurodata / ndstore / test / test_image.py View on Github external
def setup_class(self):
    p.datatype = UINT8
    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype)
github neurodata / ndstore / test / test_raw.py View on Github external
import makeunitdb
from ndlib.ndtype import IMAGE, UINT8, UINT16
from params import Params
from postmethods import postNPZ, getRAW
from test_settings import *

# Test_RAW
# 1 - test_get_raw

p = Params()
p.token = 'unittest'
p.resolution = 0
p.channels = ['IMAGE1', 'IMAGE2']
p.window = [0,500]
p.channel_type = IMAGE
p.datatype = UINT8
p.voxel = [4.0,4.0,3.0]


class Test_Raw:

  def setup_class(self):

    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype)

  def teardown_class(self):
    makeunitdb.deleteTestDB(p.token)


  def test_get_raw (self):
    """Test the xyz cube cutout"""
github neurodata / ndstore / test / test_time.py View on Github external
# 2 - test_npz_incorrect_region
# 3 - test_npz_incorrect_datatype
# 4 - test_hdf5
# 5 - test_hdf5_incorrect_region
# 6 - test_hdf5_incorrect_datatype
# 7 - test_npz_incorrect_channel
# 8 - test_hdf5_incorrect_channel


p = Params()
p.token = 'unittest'
p.resolution = 0
p.channels = ['TIME1', 'TIME2']
p.time = [0,100]
p.channel_type = TIMESERIES
p.datatype = UINT8
p.window = [0,500]
p.voxel = [4.0,4.0,3.0]


class Test_Time_Slice:


  def setup_class(self):

    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype, time=p.time)

  def teardown_class(self):
    makeunitdb.deleteTestDB(p.token)


  def test_xy (self):
github neurodata / ndstore / test / test_time.py View on Github external
def setup_class(self):
    p.channels = ['TIME1', 'TIME2']
    p.datatype = UINT8
    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype, time=p.time, default=True )
github neurodata / ndstore / test / test_blosc.py View on Github external
from ndlib.ndtype import IMAGE, UINT8, UINT16
from params import Params
from postmethods import postNPZ, getNPZ, getHDF5, postHDF5, getURL, postBlosc, getBlosc
from test_settings import *

# Test_Blosc
# 1 - test_get_blosc
# 2 - test_post_blosc

p = Params()
p.token = 'unittest'
p.resolution = 0
p.channels = ['IMAGE1', 'IMAGE2']
p.window = [0,500]
p.channel_type = IMAGE
p.datatype = UINT8
p.voxel = [4.0,4.0,3.0]

class Test_Blosc:

  def setup_class(self):

    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype)

  def teardown_class(self):
    makeunitdb.deleteTestDB(p.token)


  def test_get_blosc (self):
    """Test the xy slice cutout"""

    p.args = (3000,3100,4000,4100,200,201)
github neurodata / ndstore / test / test_autoingest.py View on Github external
os.environ['DJANGO_SETTINGS_MODULE'] = 'ND.settings'
from ingest.core.config import Configuration
from ndlib.ndtype import IMAGE, UINT8, MYSQL
from params import Params
from postmethods import getJSON, postJSON, deleteJSON, postURL
import makeunitdb
import site_to_test
SITE_HOST = site_to_test.site

p = Params()
p.token = 'unittest'
p.project = 'unittest'
p.resolution = 0
p.channels = ['CHAN1', 'CHAN2']
p.channel_type = IMAGE
p.datatype = UINT8
p.dataset = 'unittest'


class Test_AutoIngest():

  def setup_class(self):
    """Setup Parameters"""
    makeunitdb.createTestDB(p.project, channel_list=p.channels, ximagesize=2000, yimagesize=2000, zimagesize=1000, xvoxelres=1.0, yvoxelres=1.0, zvoxelres=5.0, token_name=p.token)
  
  def teardown_class(self):
    """Teardown Parameters"""
    makeunitdb.deleteTestDB(p.project, token_name=p.token)
  
  def test_post_config(self):
    
    with open(os.path.abspath('../ingest-client/ingest/configs/neurodata-catmaid-file-stack-example.json'), 'rt') as example_file:
github neurodata / ndstore / test / test_jpeg.py View on Github external
import makeunitdb
from ndlib.ndtype import IMAGE, UINT8, UINT16
from params import Params
from postmethods import postNPZ, getNPZ, getHDF5, postHDF5, getURL, postBlosc, getBlosc
from test_settings import *

# Test_Jpeg
# 1 - test_get_jpeg

p = Params()
p.token = 'unittest'
p.resolution = 0
p.channels = ['IMAGE1', 'IMAGE2']
p.window = [0,500]
p.channel_type = IMAGE
p.datatype = UINT8
p.voxel = [4.0,4.0,3.0]
#p.args = (3000,3100,4000,4100,500,510)


class Test_Jpeg:

  def setup_class(self):

    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype)

  def teardown_class(self):
    makeunitdb.deleteTestDB(p.token)


  def test_get_jpeg (self):
    """Test the jpeg volume cutout"""
github neurodata / ndstore / test / test_image.py View on Github external
# 2 - test_npz_incorrect_region
# 3 - test_npz_incorrect_datatype
# 4 - test_hdf5
# 5 - test_hdf5_incorrect_region
# 6 - test_hdf5_incorrect_datatype
# 7 - test_npz_incorrect_channel
# 8 - test_hdf5_incorrect_channel


p = Params()
p.token = 'unittest'
p.resolution = 0
p.channels = ['IMAGE1', 'IMAGE2']
p.window = [0,500]
p.channel_type = IMAGE
p.datatype = UINT8
p.voxel = [4.0,4.0,3.0]
#p.args = (3000,3100,4000,4100,500,510)


class Test_Image_Slice:

  def setup_class(self):
    """Setup class parameters"""
    makeunitdb.createTestDB(p.token, channel_list=p.channels, channel_type=p.channel_type, channel_datatype=p.datatype)

  def teardown_class(self):
    """Cleanup class parameters"""
    makeunitdb.deleteTestDB(p.token)

  def test_xy (self):
    """Test the xy slice cutout"""
github neurodata / ndstore / test / test_resource.py View on Github external
import pytest
sys.path += [os.path.abspath('../django')]
import ND.settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'ND.settings'
from ndlib.ndtype import TIMESERIES, UINT8, MYSQL
from params import Params
from ndlib.restutil import getJson, postJson, deleteJson
from test_settings import *

p = Params()
p.token = 'unittest'
p.project = 'unittest'
p.resolution = 0
p.channels = ['CHAN1', 'CHAN2']
p.channel_type = TIMESERIES
p.datatype = UINT8
p.dataset = 'unittest'

@pytest.mark.skipif(DEV_MODE, reason='Test not necessary for dev mode')
class Test_Resource():

  def setup_class(self):
    """Setup Parameters"""
    # makeunitdb.createTestDB(p.project, channel_list=p.channels, ximagesize=2000, yimagesize=2000, zimagesize=1000, xvoxelres=1.0, yvoxelres=1.0, zvoxelres=5.0, token_name=p.token)
    pass
  
  def teardown_class(self):
    """Teardown Parameters"""
    try:
      makeunitdb.deleteTestDB(p.project, token_name=p.token)
    except Exception as e:
      pass
github neurodata / ndstore / test / test_resource.py View on Github external
def test_get_project_error(self):
    response = getJson('https://{}/resource/dataset/{}/project/{}/'.format(SITE_HOST, p.dataset, 'foo'))
    assert(response.status_code == 404)