kushalkolar / MESmerize

Platform for Calcium Imaging analysis. DEPRECATED.
GNU General Public License v3.0
58 stars 14 forks source link

Extract and load metadata from Zeiss czi image stacks #99

Closed JCKMes closed 1 year ago

JCKMes commented 2 years ago

Is your feature request related to a problem? Please describe. Thank you for writing and sharing the software with the research community. I have installed mesmerize 0.7.1 on Windows 10 using windows power shell. I could load the tiff stacks but could not get and load metadata from Zeiss czi files or ome.tiff files in the specified formats (Awesomeimager, is_app, json_minimal, ome_tiff, ome_tif).

I read the instructions here, http://docs.mesmerizelab.org/en/master/user_guides/viewer/modules/tiff_file.html#module-tifffile-console but could not get it done. I will be of great help if some one could please suggest step by step instructions on how to extract metadata from Zeiss czi files and load that in Mesmerize. I am not a programmer and has no knowledge in Python.

Describe the solution or feature you'd like I would like to have the possibility to load metadata from Zeiss czi files. I can see the metadata when I open the czi images in Fiji ImageJ using Import via Bioformat.

Do you think this feature will be useful for a broad range of users or is it very specific to your problem or particular analysis method It will help many thousand people who use Zeiss software for biological imaging (calcium imaging and membrane potential imaging)

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. After loading the Tiff stack, I pasted the following in the console: I pasted the following lines in the console but did not help: 1 image_path = C:\MesmerizeJCK\JCK001.ome.tiff # path to tiff file 2 3 clear_workEnv() # Prevents a confirmation dialog from appearing 4 5 # Get the tiff module 6 tio = get_module('tiff_io', hide=True) 7 8 # Load the tiff file 9 tio.load(image_path, method='imread', axes_order='txy') 10 11 meta_dict = \ 12 { 13 "origin": "Instrument0", # must a str 14 "fps": 0.20, # must be a int or float 15 "date" "20211028_170623" # must be a str formatted as "YYYYMMDD_HHMMSS"/ 16 } 17 18 get_workEnv().imgdata.meta = meta_dict

Additional context Add any other context, a diagram or screenshots about the feature request here. image

kushalkolar commented 2 years ago

@JCKMes

Please see last line of the error message:

xmltodict must be installed to use ome_tiff meta data

pip install xmltodict
JCKMes commented 2 years ago

Many thanks for the fast reply Kushalkolar. I installed xmltodict and now I get this error:

Traceback (most recent call last): File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\mesmerize\viewer\core\viewer_work_environment.py", line 359, in from_tiff meta = getattr(organize_metadata, meta_format)(meta_path) File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\mesmerize\viewer\core\organize_metadata.py", line 120, in ome_tiff ome_meta = xmltodict.parse(tif.ome_metadata) File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\xmltodict.py", line 378, in parse parser.Parse(xml_input, True) TypeError: a bytes-like object is required, not 'dict'

My Work dir is C:\Users\user name.mesmerize\working_dir and the tiff and ome.tiff files are in C:\mesmerize_path

I pasted the following lines in the console: 1 image_path = C:\mesmerize_path # path to tiff file 2 3 clear_workEnv() # Prevents a confirmation dialog from appearing 4 5 # Get the tiff module 6 tio = get_module('tiff_io', hide=True) 7 8 # Load the tiff file 9 tio.load(image_path, method='imread', axes_order='txy') 10 11 meta_dict = \ 12 { 13 "origin": "Instrument0", # must a str 14 "fps": 0.20, # must be a int or float 15 "date" "20211028_170623" # must be a str formatted as "YYYYMMDD_HHMMSS"/ 16 } 17 18 get_workEnv().imgdata.meta = meta_dict

Could you please advise me on how to get it working.

Thanks a lot.

kushalkolar commented 2 years ago

@JCKMes I'm guessing this is something specific to thr Zeiss OME tiff. I would just set the framerate and not worry about the rest of the meta data.

JCKMes commented 2 years ago

Thank you again Kushalkolar. To load the meta data, I pasted this to the console, but did not work. I am not sure if the syntax is correct. I did not load the ome.tiff file separately.

How do I indicate a frame rate of 0.2? Is it 0.2 or "0.2" or 0.2, ?

1 image_path = C:\Users\Jaideep Kesavan\mesmerize_path # path to tiff file 2 meta_path = C:\Users\Jaideep Kesavan\mesmerize_path 3 clear_workEnv() # Prevents a confirmation dialog from appearing 4 5 # Get the tiff module 6 tio = get_module('tiff_io', hide=True) 7 8 # Load the tiff file 9 tio.load(image_path, method='imread', axes_order='txy') 10 11 meta_dict = \ 12 { 13
14 "fps": 0.20, # must be a int or float 15
16 } 17 18 get_workEnv().imgdata.meta = meta_dict 19 get_meta()['fps'] = 0.2

The error message is:

File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\mesmerize\viewer\core\add_to_project.py", line 197, in add_to_dataframe dicts_to_append = self.work_environment.to_pandas(configuration.proj_path) File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\mesmerize\viewer\core\viewer_work_environment.py", line 515, in to_pandas raise AttributeError("Sampling rate of the image data is not set." AttributeError: Sampling rate of the image data is not set.You must set `viewer.workEnv.imgdata.meta['fps']. If you are using the viewer console you can do: get_meta()['fps'] =

Could you please advise me on what exactly shall I type in the console to input the frame rate.

Many thanks.

kushalkolar commented 2 years ago

I think you can just load the tiff file using the gui, select to not load the meta data, and then in the console:

get_meta()['fps'] = 0.2

Btw if you don't know Python I'd strongly advice you to learn the basics before proceeding. Otherwise you will not understand caiman or downstream analysis.

On Sun, May 15, 2022, 18:13 JCKMes @.***> wrote:

Thank you again Kushalkolar. To load the meta data, I pasted this to the console, but did not work. I am not sure if the syntax is correct. I did not load the ome.tiff file separately.

How do I indicate a frame rate of 0.2? Is it 0.2 or "0.2" or 0.2, ?

1 image_path = C:\Users\Jaideep Kesavan\mesmerize_path # path to tiff file 2 meta_path = C:\Users\Jaideep Kesavan\mesmerize_path 3 clear_workEnv() # Prevents a confirmation dialog from appearing 4 5 # Get the tiff module 6 tio = get_module('tiff_io', hide=True) 7 8 # Load the tiff file 9 tio.load(image_path, method='imread', axes_order='txy') 10 11 meta_dict = 12 { 13 14 "fps": 0.20, # must be a int or float 15 16 } 17 18 get_workEnv().imgdata.meta = meta_dict 19 get_meta()['fps'] = 0.2

The error message is:

File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\mesmerize\viewer\core\add_to_project.py", line 197, in add_to_dataframe dicts_to_append = self.work_environment.to_pandas(configuration.proj_path) File "C:\ProgramData\Miniconda3\envs\mesmerize\lib\site-packages\mesmerize\viewer\core\viewer_work_environment.py", line 515, in to_pandas raise AttributeError("Sampling rate of the image data is not set." AttributeError: Sampling rate of the image data is not set.You must set `viewer.workEnv.imgdata.meta['fps']. If you are using the viewer console you can do: get_meta()['fps'] =

Could you please advise me on what exactly shall I type in the console to input the frame rate.

Many thanks.

— Reply to this email directly, view it on GitHub https://github.com/kushalkolar/MESmerize/issues/99#issuecomment-1126971842, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRCVAILIKBHDHEN6BDTVKEPB7ANCNFSM5V56WFVA . You are receiving this because you were assigned.Message ID: @.***>

JCKMes commented 2 years ago

Thank you again. I also realized that without a basic or intermediate level of programming skills in Python, it will be impossible to use Mesmerize. I will learn Python.

I am wondering is it possible to open or import fluorescence intensity data in csv or any table format (time verses intensity at each point) calculated elsewhere (FluoroSNNAP or ImageJ Fiji) and perform downstream analysis (network parameters, cross correlation etc.) and create graphs in Mesmerize until I learn Python.

Thanks a lot.

kushalkolar commented 2 years ago

I don't know anything Fluorosnap, but I'd suggest you do that downstream analysis elsewhere. Jupyter notebooks are great once you have a basic understanding of Python.

On Sun, May 15, 2022, 19:31 JCKMes @.***> wrote:

Thank you again. I also realized that without a basic or intermediate level of programming skills in Python, it will be impossible to use Mesmerize. I will learn Python.

I am wondering is it possible to open or import fluorescence intensity data in csv or any table format (time verses intensity at each point) calculated elsewhere (FluoroSNNAP or ImageJ Fiji) and perform downstream analysis (network parameters, cross correlation etc.) and create graphs in Mesmerize until I learn Python.

Thanks a lot.

— Reply to this email directly, view it on GitHub https://github.com/kushalkolar/MESmerize/issues/99#issuecomment-1126983455, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRFTUI5KVB3RCGKAS5DVKEYFLANCNFSM5V56WFVA . You are receiving this because you were assigned.Message ID: @.***>

JCKMes commented 2 years ago

Thank you, FluoroSNNAP is a similar program from University of Pennsylvania, but not so versatile as Mesmerize and is in Matlab. Here is the link:

https://www.seas.upenn.edu/~molneuro/software.html

https://www.seas.upenn.edu/~molneuro/FluoroSNNAP/user_guide.pdf

I am wondering if there is small TIFF file (less than 1 GB) and associated meta data available for download to lean Mesmerize for those who have problems with loading meta data. I could download this, but the compressed file itself is above 6 GB and might need lot of computational time on a home laptop with 8 GB RAM.

https://figshare.com/articles/dataset/Mesmerize_volumetric_zebrafish_dataset/14748915

Thank you all the support.

kushalkolar commented 2 years ago

you can just create a minimal dict and save that as a json file with the same name as the corresponding tif file as outlined in the docs

JCKMes commented 2 years ago

Thank you. I will try this method.

kushalkolar commented 1 year ago

You can try the caiman demo movies. I would go through the caiman demo notebooks first and then get into mesmerize to make your process faster and more efficient.

On Sun, May 15, 2022, 20:11 JCKMes @.***> wrote:

Thank you, FluoroSNNAP is a similar program from University of Pennsylvania, but not so versatile as Mesmerize and is in Matlab. Here is the link:

https://www.seas.upenn.edu/~molneuro/software.html

https://www.seas.upenn.edu/~molneuro/FluoroSNNAP/user_guide.pdf

I am wondering if there is small TIFF file (less than 1 GB) and associated meta data available for download to lean Mesmerize for those who have problems with loading meta data. I could download this, but the compressed file itself is above 6 GB and might need lot of computational time on a home laptop with 8 GB RAM.

https://figshare.com/articles/dataset/Mesmerize_volumetric_zebrafish_dataset/14748915

Thank you all the support.

— Reply to this email directly, view it on GitHub https://github.com/kushalkolar/MESmerize/issues/99#issuecomment-1126989370, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRHK5LOLFX3I3MMBKYDVKE44VANCNFSM5V56WFVA . You are receiving this because you were assigned.Message ID: @.***>

JCKMes commented 1 year ago

Many thanks!

Jaideep Cherakka Kesavan Post-doctoral Researcher

Physiology & Medical Physics 123 SSG Ireland

E: @.*** W: www.rcsi.comhttp://www.rcsi.com/

Discover why we are Top 50 in the World for 'International Outlook' - THE World University Ranking 2022https://www.rcsi.com/about/international

[cid:rcsi-signature-standard-2022-10_70dad9fd-d8a8-4c92-8275-9020ce8f9ee6.png]

If you receive this email outside of your normal working hours, you are not expected to respond until you return to work.

Registered Charity Number: 20001957


From: Kushal Kolar @.> Sent: 11 October 2022 10:15 To: kushalkolar/MESmerize @.> Cc: Jaideep Cherakka Kesavan @.>; Mention @.> Subject: Re: [kushalkolar/MESmerize] Extract and load metadata from Zeiss czi image stacks (Issue #99)

CAUTION: This email originated from outside of the organisation. Do not click links or open attachments unless you recognise the sender and know that the content is safe.

You can try the caiman demo movies. I would go through the caiman demo notebooks first and then get into mesmerize to make your process faster and more efficient.

On Sun, May 15, 2022, 20:11 JCKMes @.***> wrote:

Thank you, FluoroSNNAP is a similar program from University of Pennsylvania, but not so versatile as Mesmerize and is in Matlab. Here is the link:

https://www.seas.upenn.edu/~molneuro/software.html

https://www.seas.upenn.edu/~molneuro/FluoroSNNAP/user_guide.pdf

I am wondering if there is small TIFF file (less than 1 GB) and associated meta data available for download to lean Mesmerize for those who have problems with loading meta data. I could download this, but the compressed file itself is above 6 GB and might need lot of computational time on a home laptop with 8 GB RAM.

https://figshare.com/articles/dataset/Mesmerize_volumetric_zebrafish_dataset/14748915

Thank you all the support.

— Reply to this email directly, view it on GitHub https://github.com/kushalkolar/MESmerize/issues/99#issuecomment-1126989370, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRHK5LOLFX3I3MMBKYDVKE44VANCNFSM5V56WFVA . You are receiving this because you were assigned.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkushalkolar%2FMESmerize%2Fissues%2F99%23issuecomment-1274375876&data=05%7C01%7Cjaideepkesavan%40rcsi.ie%7C067aeeb77c4a46631bb808daab691a74%7C607041e7a8124670bd3030f9db210f06%7C0%7C0%7C638010766652013883%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=grTCxGK6jsRcW5bIb2g4Z6odX%2BJ24zGIvWlmAfTZnkE%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAZFMHF4VXEIM662ABQB465LWCUVZ7ANCNFSM5V56WFVA&data=05%7C01%7Cjaideepkesavan%40rcsi.ie%7C067aeeb77c4a46631bb808daab691a74%7C607041e7a8124670bd3030f9db210f06%7C0%7C0%7C638010766652013883%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cM6mOiVEk%2B5EB8R4HyTSLTHHe76MGvYpzkp1JsZyrYA%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>