Ejemplo n.º 1
0
def setup():
    global stack_iter
    global metadata
    image_path_list = data.stack_list()

    metadata = {"PhysicalSizeX": 0.42,
                "PhysicalSizeY": 0.42,
                "PhysicalSizeZ": 1.5,
                "TimeIncrement": 3,
                "FileName": '',
                "Shape": [1, 1, 512, 512],
                "DimensionOrder": "TZYX"}

    metadata['FileName'] = image_path_list[0]
    stack_io = StackIO(image_path_list=image_path_list,
                       metadata=metadata)

    im0 = stack_io.get_tif().asarray()
    correct_metadata = {'FileName': os.path.basename(image_path_list[0]),
                        'SizeX': im0.shape[2],
                        'SizeY': im0.shape[1],
                        'SizeZ': im0.shape[0],
                        'SizeT': len(image_path_list),
                        'Shape': (len(image_path_list),
                                  im0.shape[2],
                                  im0.shape[1],
                                  im0.shape[0])}

    stack_io.metadata.update(correct_metadata)
    metadata = stack_io.metadata
    stack_iter = stack_io.list_iterator()
Ejemplo n.º 2
0
def test_stackio_image_iterator():
    fname = data.CZT_peaks()
    st = StackIO(fname, json_discovery=False)

    arr = st.get_tif().asarray(memmap=True)

    iterator = st.image_iterator(channel_index=0, memmap=True)
    for a in iterator():
        assert a.shape == arr.shape[-2:]

    # Test with channels index

    fname = data.CZT_peaks()
    st = StackIO(fname, json_discovery=False)

    assert_raises(TypeError,
                  st.image_iterator,
                  hannel_index='GFP',
                  memmap=True)

    st.metadata['Channels'] = ['GFP']
    it = st.image_iterator(channel_index='GFP',
                           memmap=False,
                           z_projection=True)
    assert list(it())[0].shape == arr.shape[-2:]
Ejemplo n.º 3
0
def setup():
    global stack_iter
    global metadata
    image_path_list = data.stack_list()

    metadata = {
        "PhysicalSizeX": 0.42,
        "PhysicalSizeY": 0.42,
        "PhysicalSizeZ": 1.5,
        "TimeIncrement": 3,
        "FileName": '',
        "Shape": [1, 1, 512, 512],
        "DimensionOrder": "TZYX"
    }

    metadata['FileName'] = image_path_list[0]
    stack_io = StackIO(image_path_list=image_path_list, metadata=metadata)

    im0 = stack_io.get_tif().asarray()
    correct_metadata = {
        'FileName': os.path.basename(image_path_list[0]),
        'SizeX': im0.shape[2],
        'SizeY': im0.shape[1],
        'SizeZ': im0.shape[0],
        'SizeT': len(image_path_list),
        'Shape':
        (len(image_path_list), im0.shape[2], im0.shape[1], im0.shape[0])
    }

    stack_io.metadata.update(correct_metadata)
    metadata = stack_io.metadata
    stack_iter = stack_io.list_iterator()