Esempio n. 1
0
    def test_basic_resource_from_dict(self):
        """Test basic to dict deserialization method

        Returns:
            None

        """
        setup_data = get_image_dict()
        resource1 = BossResourceBasic(setup_data)

        resource2 = BossResourceBasic()
        resource2.from_dict(resource1.to_dict())

        # Check Collection
        col = resource2.get_collection()
        assert col.name == setup_data['collection']['name']
        assert col.description == setup_data['collection']['description']

        # Check coord frame
        coord = resource2.get_coord_frame()
        assert coord.name == setup_data['coord_frame']['name']
        assert coord.description == setup_data['coord_frame']['description']
        assert coord.x_start == setup_data['coord_frame']['x_start']
        assert coord.x_stop == setup_data['coord_frame']['x_stop']
        assert coord.y_start == setup_data['coord_frame']['y_start']
        assert coord.y_stop == setup_data['coord_frame']['y_stop']
        assert coord.z_start == setup_data['coord_frame']['z_start']
        assert coord.z_stop == setup_data['coord_frame']['z_stop']
        assert coord.x_voxel_size == setup_data['coord_frame']['x_voxel_size']
        assert coord.y_voxel_size == setup_data['coord_frame']['y_voxel_size']
        assert coord.z_voxel_size == setup_data['coord_frame']['z_voxel_size']
        assert coord.voxel_unit == setup_data['coord_frame']['voxel_unit']


        # Check exp
        exp = resource2.get_experiment()
        assert exp.name == setup_data['experiment']['name']
        assert exp.description == setup_data['experiment']['description']
        assert exp.num_hierarchy_levels == setup_data['experiment']['num_hierarchy_levels']
        assert exp.hierarchy_method == setup_data['experiment']['hierarchy_method']
        assert exp.num_time_samples == setup_data['experiment']['num_time_samples']
        assert exp.time_step == setup_data['experiment']['time_step']
        assert exp.time_step_unit == setup_data['experiment']['time_step_unit']

        # Check channel
        channel = resource2.get_channel()
        assert channel.is_image() is True
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']

        # check keys
        assert resource2.get_lookup_key() == setup_data['lookup_key']
        assert resource2.get_boss_key() == setup_data['boss_key']
Esempio n. 2
0
    def test_basic_resource_from_dict(self):
        """Test basic to dict deserialization method

        Returns:
            None

        """
        setup_data = get_image_dict()
        resource1 = BossResourceBasic(setup_data)

        resource2 = BossResourceBasic()
        resource2.from_dict(resource1.to_dict())

        # Check Collection
        col = resource2.get_collection()
        assert col.name == setup_data['collection']['name']
        assert col.description == setup_data['collection']['description']

        # Check coord frame
        coord = resource2.get_coord_frame()
        assert coord.name == setup_data['coord_frame']['name']
        assert coord.description == setup_data['coord_frame']['description']
        assert coord.x_start == setup_data['coord_frame']['x_start']
        assert coord.x_stop == setup_data['coord_frame']['x_stop']
        assert coord.y_start == setup_data['coord_frame']['y_start']
        assert coord.y_stop == setup_data['coord_frame']['y_stop']
        assert coord.z_start == setup_data['coord_frame']['z_start']
        assert coord.z_stop == setup_data['coord_frame']['z_stop']
        assert coord.x_voxel_size == setup_data['coord_frame']['x_voxel_size']
        assert coord.y_voxel_size == setup_data['coord_frame']['y_voxel_size']
        assert coord.z_voxel_size == setup_data['coord_frame']['z_voxel_size']
        assert coord.voxel_unit == setup_data['coord_frame']['voxel_unit']


        # Check exp
        exp = resource2.get_experiment()
        assert exp.name == setup_data['experiment']['name']
        assert exp.description == setup_data['experiment']['description']
        assert exp.num_hierarchy_levels == setup_data['experiment']['num_hierarchy_levels']
        assert exp.hierarchy_method == setup_data['experiment']['hierarchy_method']
        assert exp.num_time_samples == setup_data['experiment']['num_time_samples']
        assert exp.time_step == setup_data['experiment']['time_step']
        assert exp.time_step_unit == setup_data['experiment']['time_step_unit']

        # Check channel
        channel = resource2.get_channel()
        assert channel.is_image() is True
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']

        # check keys
        assert resource2.get_lookup_key() == setup_data['lookup_key']
        assert resource2.get_boss_key() == setup_data['boss_key']
Esempio n. 3
0
    def test_basic_resource_annotation_no_time(self):
        """Test basic get layer interface

        Returns:
            None

        """
        setup_data = get_anno_dict()
        resource = BossResourceBasic(setup_data)

        channel = resource.get_channel()
        assert channel.is_image() is False
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']
Esempio n. 4
0
    def test_basic_resource_annotation_no_time(self):
        """Test basic get layer interface

        Returns:
            None

        """
        setup_data = get_anno_dict()
        resource = BossResourceBasic(setup_data)

        channel = resource.get_channel()
        assert channel.is_image() is False
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']
Esempio n. 5
0
    def test_basic_resource_channel_with_related(self):
        """Test basic get channel interface

        Returns:
            None

        """
        setup_data = get_image_dict()
        setup_data['channel']['related'] = ["ch_2", "ch_3"]
        resource = BossResourceBasic(setup_data)

        channel = resource.get_channel()
        assert channel.is_image() is True
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']
Esempio n. 6
0
    def test_basic_resource_channel_with_related(self):
        """Test basic get channel interface

        Returns:
            None

        """
        setup_data = get_image_dict()
        setup_data['channel']['related'] = ["ch_2", "ch_3"]
        resource = BossResourceBasic(setup_data)

        channel = resource.get_channel()
        assert channel.is_image() is True
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']
Esempio n. 7
0
    def test_basic_resource_channel_cloudvolume_uint16(self):
        """Test basic get channel interface

        Returns:
            None

        """
        setup_data = get_image_dict(datatype="uint16", storage_type='cloudvol')
        resource = BossResourceBasic(setup_data)

        channel = resource.get_channel()
        assert channel.is_image() is True
        assert channel.is_cloudvolume() is True
        assert channel.name == setup_data['channel']['name']
        assert channel.description == setup_data['channel']['description']
        assert channel.datatype == setup_data['channel']['datatype']
        assert channel.base_resolution == setup_data['channel']['base_resolution']
        assert channel.sources == setup_data['channel']['sources']
        assert channel.related == setup_data['channel']['related']
        assert channel.default_time_sample == setup_data['channel']['default_time_sample']
        assert channel.downsample_status == setup_data['channel']['downsample_status']
        assert channel.storage_type == setup_data['channel']['storage_type']
        assert channel.bucket == setup_data['channel']['bucket']
        assert channel.cv_path == setup_data['channel']['cv_path']