aelefebv / nellie

Nellie: Automated organelle segmentation, tracking, and hierarchical feature extraction in 2D/3D live-cell microscopy
Other
30 stars 4 forks source link

Error importing file #12

Closed su2804 closed 5 months ago

su2804 commented 5 months ago

Hi, I was trying to use this tool but had some issues during file import. I tried following the instructions: imported a nd2 file in FiJi, cropped a small region and then exported it using BioFormats exporter to a .ome.tiff format but get the following error: `--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File /opt/anaconda3/envs/napari-env/lib/python3.9/site-packages/nellie_napari/nellie_fileselect.py:383, in NellieFileSelect.select_filepath(self=) 380 return 381 self.single = True --> 383 self.initialize_single_file() self = <nellie_napari.nellie_fileselect.NellieFileSelect object at 0x219fc3ca0> 384 filename = os.path.basename(self.filepath) 385 show_info(f"Selected file: {filename}")

File /opt/anaconda3/envs/napari-env/lib/python3.9/site-packages/nellie_napari/nellie_fileselect.py:263, in NellieFileSelect.initialize_single_file(self=) 261 dim_sizes, dim_order = self.check_manual_params() 262 # open the file and load its info --> 263 self.im_info = ImInfo(self.filepath, ch=self.nellie.processor.channel_input.value(), dimension_order=dim_order, dim_sizes=dim_sizes) self.im_info = None dim_sizes = None dim_order = '' self = <nellie_napari.nellie_fileselect.NellieFileSelect object at 0x219fc3ca0> self.filepath = '/Users/saranshumale/Documents/Data/y.Org.Fractions/nellie/glu.ome.tiff' self.nellie = <nellie_napari.nellie_loader.NellieLoader object at 0x1b80df4c0> self.nellie.processor.channel_input = <PyQt5.QtWidgets.QSpinBox object at 0x21a873b80> self.nellie.processor = <nellie_napari.nellie_processor.NellieProcessor object at 0x21a873af0> 264 self.nellie.im_info = self.im_info 265 self.dim_order = self.im_info.axes

File /opt/anaconda3/envs/napari-env/lib/python3.9/site-packages/nellie/im_info/im_info.py:48, in ImInfo.init(self=, im_path='/Users/saranshumale/Documents/Data/y.Org.Fractions/nellie/glu.ome.tiff', output_dirpath=None, screenshot_dirpath=None, ch=0, dim_sizes=None, dimension_order='', output_suffix='') 45 self._load_metadata() 47 if self.dim_sizes is None: ---> 48 self._set_dim_sizes() self = <nellie.im_info.im_info.ImInfo object at 0x1bedcf9a0> 50 self.no_z = True 51 self.no_t = True

File /opt/anaconda3/envs/napari-env/lib/python3.9/site-packages/nellie/im_info/im_info.py:202, in ImInfo._set_dim_sizes(self=) 200 self.metadata = {} 201 self.dim_sizes = {} --> 202 raise e

File /opt/anaconda3/envs/napari-env/lib/python3.9/site-packages/nellie/im_info/im_info.py:139, in ImInfo._set_dim_sizes(self=) 137 self.dim_sizes['T'] = self.metadata.images[0].pixels.time_increment 138 elif self.metadata_type is None: --> 139 tag_names = {tag_value.name: tag_code for tag_code, tag_value in self.metadata.items()} self.metadata = {} self = <nellie.im_info.im_info.ImInfo object at 0x1bedcf9a0> 141 if 'XResolution' in tag_names: 142 self.dim_sizes['X'] = self.metadata[tag_names['XResolution']].value[1] \ 143 / self.metadata[tag_names['XResolution']].value[0]

AttributeError: 'NoneType' object has no attribute 'items'`

Appreciate any help!

aelefebv commented 5 months ago

@su2804 Hmm weird! Looks like it didn't recognize the exported metadata. Any chance you can send me the file you were trying to run? It'd be helpful to have the original and the cropped version

su2804 commented 5 months ago

Hi, sure, here's the cropped file. The nd2 file I cropped is a bit large to share here :/

On Fri, Mar 22, 2024 at 5:44 PM Austin Epiphane Yann Tung-Shan Lefebvre < @.***> wrote:

@su2804 https://urldefense.com/v3/__https://github.com/su2804__;!!Mih3wA!EpszydVVYvd4e-giqt8t6hcNg0tnf4mN5D9qEmAxHvEi40W_U0CNkCNDSBh79LjJLC-trxifTvIDggkb9nIi9V0$ Hmm weird! Looks like it didn't recognize the exported metadata. Any chance you can send me the file you were trying to run? It'd be helpful to have the original and the cropped version

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/aelefebv/nellie/issues/12*issuecomment-2016235747__;Iw!!Mih3wA!EpszydVVYvd4e-giqt8t6hcNg0tnf4mN5D9qEmAxHvEi40W_U0CNkCNDSBh79LjJLC-trxifTvIDggkbL74f6dc$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AOOTKGMLSD53AHVZPYX4U4LYZTF5JAVCNFSM6AAAAABFEFTLN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJWGIZTKNZUG4__;!!Mih3wA!EpszydVVYvd4e-giqt8t6hcNg0tnf4mN5D9qEmAxHvEi40W_U0CNkCNDSBh79LjJLC-trxifTvIDggkbhcVxh0Q$ . You are receiving this because you were mentioned.Message ID: @.***>

aelefebv commented 5 months ago

Can you email me directly at austin.e.lefebvre@gmail.com The file isn't showing up on the issues page.

aelefebv commented 5 months ago

Okay! I've figured out both issues. The first issue was that the file ended with .tiff instead of .tif, which I didn't account for (my bad). So that works now, and your exported cropped image should get past that error. However, your images appear to be ZYX, and right now you can only use datasets with a time series.

I'll incorporate the ability to run non-time series data, and retrieve morphology info, but if you want to hack it in the meantime, just triplicate the image and make it into a time series of 3 frames, and it should run fully

aelefebv commented 5 months ago

By the way, you can also run the steps individually, both run preprocessing and run segmentation should work no problem, then you can visualize both of those in the visualize tab

su2804 commented 5 months ago

Voila, thanks so much. It indeed works now, super excited to try it more in the next few days!