Esempio n. 1
0
def test_imsave_multi():
    im = imread(file_path('arange512_16bit.png'))
    im2 = im[::4, ::4]
    ims = [im, im2]
    imsave_multi(_filename, ims)
    ims2 = imread_multi(_filename)
    assert len(ims) == len(ims2)
    for a,b in zip(ims, ims2):
        assert np.all(a == b)
Esempio n. 2
0
def test_imsave_multi():
    im = imread(file_path('arange512_16bit.png'))
    im2 = im[::4, ::4]
    ims = [im, im2]
    imsave_multi(_filename, ims)
    ims2 = imread_multi(_filename)
    assert len(ims) == len(ims2)
    for a, b in zip(ims, ims2):
        assert np.all(a == b)
Esempio n. 3
0
def test_multi():
    assert len(imread_multi(file_path('stack.tiff'))) == 2
Esempio n. 4
0
def test_multi():
    assert len(imread_multi('imread/tests/data/stack.tiff')) == 2
Esempio n. 5
0
def test_multi():
    assert len(imread_multi(file_path('stack.tiff'))) == 2
    valid_set = (np.zeros((nvalid, imgd * imgd),
                          dtype=np.uint8), np.zeros(nvalid, dtype=np.uint8))
    test_set = (np.zeros((ntest, imgd * imgd),
                         dtype=np.uint8), np.zeros(ntest, dtype=np.uint8))

    random.seed(seed)

    train_i = 0
    valid_i = 0
    test_i = 0
    sample_count = 0

    for imgi in range(zrad, nimages - zrad):

        file_index = start_image + imgi
        input_img = normalize_image(imread.imread_multi(image_input)[imgi])
        #print img_files[file_index]
        label_img = mahotas.imread(label_input)[imgi]
        #print seg_files[file_index]

        if len(label_img.shape) == 3:
            label_img = label_img[:, :,
                                  0] * 2**16 + label_img[:, :,
                                                         1] * 2**8 + label_img[:, :,
                                                                               2]

        input_vol = np.zeros((input_img.shape[0], input_img.shape[1]),
                             dtype=np.uint8)
        input_vol[:, :] = input_img

        blur_img = scipy.ndimage.gaussian_filter(input_img, gblur_sigma)
Esempio n. 7
0
def test_multi():
    assert len(imread_multi('imread/tests/data/stack.tiff')) == 2
Esempio n. 8
0
 def open_file(self, fname):
     from imread import imread_multi
     return imread_multi(fname)
for seed in random_seeds:
    train_set = (np.zeros((ntrain, imgd*imgd), dtype=np.uint8), np.zeros(ntrain, dtype=np.uint8))
    valid_set = (np.zeros((nvalid, imgd*imgd), dtype=np.uint8), np.zeros(nvalid, dtype=np.uint8))
    test_set = (np.zeros((ntest, imgd*imgd), dtype=np.uint8), np.zeros(ntest, dtype=np.uint8))

    random.seed(seed)

    train_i = 0;
    valid_i = 0;
    test_i = 0;
    sample_count = 0;

    for imgi in range (zrad, nimages-zrad):

        file_index = start_image + imgi
        input_img = normalize_image(imread.imread_multi(image_input)[imgi])
        #print img_files[file_index]
        label_img = mahotas.imread(label_input)[imgi]
        #print seg_files[file_index]

        if len( label_img.shape ) == 3:
            label_img = label_img[ :, :, 0 ] * 2**16 + label_img[ :, :, 1 ] * 2**8 + label_img[ :, :, 2 ]

        input_vol = np.zeros((input_img.shape[0], input_img.shape[1]), dtype=np.uint8)
        input_vol[:,:] = input_img

        blur_img = scipy.ndimage.gaussian_filter(input_img, gblur_sigma)

        membrane = label_img==0;
        non_membrane = ~membrane