Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Format]: TiffConverter #718

Open
2 tasks done
bendichter opened this issue Feb 5, 2024 · 12 comments
Open
2 tasks done

[New Format]: TiffConverter #718

bendichter opened this issue Feb 5, 2024 · 12 comments

Comments

@bendichter
Copy link
Contributor

What format would you like to see added to NeuroConv?

We should be able to handle a directory of Tiff files that are single frames. This could be input either by a long list of files, or by the directory that contains these files. The current Tiff interface example clearly states that it is not meant to be used for a sequence of tiff frames: https://neuroconv.readthedocs.io/en/main/conversion_examples_gallery/imaging/tiff.html

Does the format have any documentation?

No response

Existing APIs for format

No response

Do you have any example files you are willing to share?

No response

Do you have any interest in helping implement the feature?

Yes.

Code of Conduct

@bendichter
Copy link
Contributor Author

needed by @ucscbrianlee

@CodyCBakerPhD CodyCBakerPhD changed the title [New Format]: Tiff sequence [New Format]: TiffConverter Feb 6, 2024
@CodyCBakerPhD
Copy link
Member

CodyCBakerPhD commented Feb 6, 2024

The question is should this take a folder_path or a list of file_paths? The reason we can use folder for ScanImage and Bruker is because they follow very well established name patterns plus other organizational metadata to know how to order the frames

Programatically (through NeuroConv), file_paths should make the most sense here, but I assume there are an awful lot of files since they are not multi-page at all? So in the GUIDE that would likely be unmanageable (might even cause performance issues with too many paths selected)

UNLESS; we mandate that the file name patterns in the folder be consistent with natsort, and we just rely on that to order things sequentially

@ucscbrianlee
Copy link

Hi Cody,

If it is helpful, here is the organization from the lab submitting data for our group. They did 4 calcium imaging recordings in 4 folders with names like this:

20230412_105024_948
20230412_105933_147
20230412_110428_559
20230412_110936_767

And in each folder there is about 480 files of TIFFs with names like this:

Time00000_ChannelFITC-Penta_Seq0000
Time00001_ChannelFITC-Penta_Seq0001.tiff
...
Time00478_ChannelFITC-Penta_Seq0478.tiff
Time00479_ChannelFITC-Penta_Seq0479.tiff

where each Tiff represents a timepoint capture

@CodyCBakerPhD
Copy link
Member

Those indeed are compliant with natsort; the question is still which is the better policy or user experience across/between the low-code solution vs. the desktop application? Letting the user have full control over the order of files in sequence, or always assuming natsort is able to order things correctly?

@bendichter
Copy link
Contributor Author

What if we require a folder and allow for an optional argument for specifying the order of the files? If that is not provided, we use natsort. We could also allow a user to define a key which is a python function used to sort the files.

@ucscbrianlee
Copy link

Hi Ben and Cody,

I'm still very new to NWB files and apologize for this question. I am about to contact the lab that has these files, I was going to request that maybe they can reformat the many TIFFs into a single TIFF -is that the right thinking?

Thanks for any advisement, and all your work building these tools!

@bendichter
Copy link
Contributor Author

@ucscbrianlee that might work

@ucscbrianlee
Copy link

Thanks!

@ucscbrianlee
Copy link

Hi @bendichter ,

This might not be the appropriate ticket/place for this question, but I have a follow-up about this data. I can open a new ticket/issue if that is best.

I met with Loic who created this data and he is going to collapse the TIFFs to a single TIFF. The issue is that beyond his unique approach of gathering input data with individual images (I think that is the reason this ticket exists) Loic also did some unique steps in the follow-up steps.

For the cell-mask, he didn't use the raw images in the TIFFS that capture changes in fluorescence overtime. Instead, at the same time in these microscope slides he was performing a MERFISH experiment. The MERLIN software produces a Cell Mask for that data (different images). Loic did some complex transformation steps to take that Cell Mask, made for MERFISH Spatial Transcriptomic analysis, to map onto his much smaller field of view for these Calcium fluorescence changes over time images. He had to crop off a lot of the larger MERFISH mask to fit to this Ca+ image space, and rotate it from tilt to fit these TIFFs of Ca+ fluoresence.

This is just to say there is a lot of unique data processing going on and a cell mask for these raw TIFFs do not map as one would expect for a regular Ca+ imaging experiment where segmentation was generated from the original raw images.

This makes layering the mask onto the NWB raw data a little misleading -I would think as a novice, but maybe not? Can NWB allow layering of additional processing data and final analsysis data with some kind of "This is not as it appears" note? This would be to say, Loic could maybe Loic layer what he has onto the raw TIFF that will be the source level, and add annotations like, "some manipulation will be required to fully relate these." In fact, that was his request, that he could layer those two levels, the cell mask and analysis, and include what I think he called a 3x3 matrix transformation (don't quote me) that would allow people to know how to work with what he has. He said otherwise it could take many days for realignment of mask, that is a complicated process.

OK, I might not have expressed this all very clearly, but I wanted to communicate it to best figure out next steps. That might be opening a new ticket with these questions? Or maybe communicate back to Loic guidance with this info. For instance, if it is totally fine in NWB to layer a mask that doesn't make inherit sense (without an additional '3x3 matrix transformation') maybe that is great, and Loic can go about just layering his mask and analysis on the raw TIFFs he will collapse to a single TIFF. I apologize for the length of this note.

Best,
Brian

@CodyCBakerPhD
Copy link
Member

I apologize for the length of this note.

No problem!

I can open a new ticket/issue if that is best.

There's some pretty rich stuff here; I'd recommend reposting the generic NWB related bits (not TIFF collapsing or NeuroConv specific parts) to the NWB helpdesk so that other people can benefit from hearing about all this

There's definitely some recommendations that can be made for the best data representation to communicate what's going on

@ucscbrianlee
Copy link

ucscbrianlee commented Mar 18, 2024 via email

@CodyCBakerPhD
Copy link
Member

WIP started on catalystneuro/roiextractors#323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants