peng-lab / BaSiCPy

MIT License
60 stars 20 forks source link

Unable to use BaSiCPy with static images #120

Closed jenna-tomkinson closed 1 year ago

jenna-tomkinson commented 1 year ago

Hello @yfukai,

I am running into an issue when attempting to use the new main branch (BaSiCPy) using static images like I had done previously with the old version (PyBaSiC) (see #81 for example of PyBaSiC usage with static images).

I have run into this error:

ValueError: Images must be 3 or 4-dimensional array, with dimension of (T,Y,X) or (T,Z,Y,X).

When I read in one static image, and convert to numpy, I get a 2D shape.

image_path = "../0.download_data/70117_20230118MM1_Ab Test_V2__2023-01-25T16_44_54-Measurement1/Images/r01c03f01p01-ch1sk1fk1fl1.tiff"

example_image = skimage.io.imread(image_path)
example_image = np.asarray(example_image)
example_image.shape

(2160, 2160)

Since the images are static and do not have a time component, I am unable to use this package now. PyBaSiC used to be able to intake a list of 2D arrays and did amazing with the static images, so I would really like to use the updated BaSiCPy for my future projects.

Is there anything on my end I can do to be able to use BaSiCPy with my static images? Am I missing a step or function?

Thank you in advance for your help!

jenna-tomkinson commented 1 year ago

This also seems to be the related to the issue mentioned in #104.

yfukai commented 1 year ago

Hi, thanks @jenna-tomkinson for your interest! I think this error is raised simply because the current package expects the image to be with the dimension (T,Y,X) or (T,Z,Y,X) (≧ 3 dimensions). This is because I haven't recognized the use case where the user supplies a single-shot image. Does it make sense to supply the image as np.array([example_image])? We might consider an automatic conversion from a 2D image into this form, but considering the 3D compatibility, I'm rather inclined to this simple solution.

yfukai commented 1 year ago

Hi @jenna-tomkinson, did it work?

jenna-tomkinson commented 1 year ago

Hi @yfukai,

Unfortunately, I have been unable to test this further due to competing priorities and current projects.

Based on current plans for this software, would my findings/responses to this issue be helpful to have in the near future? If so, I would be happy to look into this issue sooner rather than later.

Thank you in advance for your response!

yfukai commented 1 year ago

Thanks @jenna-tomkinson, no worry, I was just wondering. I'm almost sure it'll work. Let me close the issue but please feel free to reopen it.