Image size error- Same image has different sizes on different cpus?

Hello! So I have Allen Segmenter downloaded on my laptop and on a desktop…but for some reason the desktop is having issues opening files because of the following error:

I noticed in the “Loading the Data” part of the workbook:
My desktop says –
print(IMG.shape)
(1, 1, 1, 141, 512, 1167) -> it has an extra 1 in there

My laptop says –
print(IMG.shape)
(1, 1, 141, 512, 1167) -> this works

I double checked that I am indeed using the exact same file on both. Any hints as to why this is happening and where the extra 1 is coming from ? The only thing I can think that may be different between the desktop installation and the laptop one is I had to use numpy 1.19.3 (instead of 1.19.4) on the desktop because it was getting a runtime error otherwise.

EDIT: The laptop (one that works) is aicsimageio version 0.6.4, aicsimageprocessing 0.7.1, aicssegmentation 0.1.18.dev1.
The desktop one is aicsimageio 3.3.1, aicsimageprocessing 0.7.1, aicssegmentation 0.1.21.dev1.

hi @mramsahoye , as you edited, the descrepency you encountered was indeed due to different aicsimageio versions. If you are using aicsimageio = 3.X.X, then you will need to use IMG[0, 0, 0, MID_SLICE, : , :] or IMG[0, 0, Channel, MID_SLICE, : , :] . If you are using aicsimageio = 0.6.x, then you will need to use IMG[0, 0, MID_SLICE, : , :] or IMG[0, Channel, MID_SLICE, : , :]. Let me know if you have more issues.

Thanks,
Jianxu

1 Like

I ran into the same issue. I needed to make the following changes to get this to run on my windows machine.

Moved folder aiscssegmentation into C:\Projects\aics-segmentation\lookup_table_demo
Manually installed aicsimageio
Manually installed scikit-image

In preview of the image, changed

MID_SLICE = np.int(0.5IMG.shape[2])
to
MID_SLICE = np.int(0.5
IMG.shape[3])

changed
ax.imshow(IMG[0,0,MID_SLICE,:,:], cmap=plt.cm.gray)
to
ax.imshow(IMG[0,0,0,MID_SLICE,:,:], cmap=plt.cm.gray)

However at the next step, I get the following error:

AssertionError Traceback (most recent call last)
in
5
6 struct_img0 = IMG[0,structure_channel,:,:,:].copy()
----> 7 view(single_fluorescent_view(struct_img0))

~\Anaconda3\Projects\aics-segmentation\lookup_table_demo\aicssegmentation\core\visual.py in single_fluorescent_view(im)
151 def single_fluorescent_view(im):
152
→ 153 assert len(im.shape)==3
154
155 im = im.astype(np.float32)

AssertionError:

you may try to update this line similarly by adding one extra dimension

Thanks,
Jianxu

struct_img0 = IMG[0,0,structure_channel,:,:,:].copy()

worked

The version of aicsimageio you are using gives back 6D images with STCZYX dimensions by default (where S is scene). That’s why the leading zero was needed to select scene 0.

Thanks! I didn’t realize that was the difference between the versions of aicsimageio.

Redefining IMG with
IMG = IMG[0].transpose(0, 2, 1, 3, 4)
also worked for me (as an alternative to the fix above).