BrentLagesse / YeastAnalysisTool

4 stars 0 forks source link

Support dv files #12

Open BrentLagesse opened 2 years ago

BrentLagesse commented 2 years ago

Currently researchers have to extract TIF files out of the deltavision dv files for us. Find a library that can correctly extract the images out of the dv files and feed them into our work.

BrentLagesse commented 2 years ago

https://github.com/tlambert03/mrc

I have confirmed that this library at least reads in dv files and converts them into a numpy array. I have not replaced it yet, but I opened 20_1212_M1914_001_PR.dv and confirmed that I see the same images in it that I see when I open up the .dv in imagej

BrentLagesse commented 2 years ago

This is some example code to extract tifs from dv files. We should re-write the code so that we don't need to load the actual tif files anymore, but maybe we should give that as an option still? We can bypass any tif reads and just directly get the numpyarray.

from mrc import DVFile from PIL import Image

f = DVFile('20_1212_M1914_001_PRJ.dv') test = f.asarray()

test_image1 = Image.fromarray(test[0]) test_image2 = Image.fromarray(test[1]) test_image3 = Image.fromarray(test[2])

test_image1.save('img1.tif') test_image2.save('img2.tif') test_image3.save('img3.tif')

print('done')

BrentLagesse commented 2 years ago

I made a commit that enabled us to read in the reference files for yeast segmentation. We still need to address the loading of all of the PRJ files. These loads happen throughout the program. I think the cleanest way to do this is going to be to have the get_DAPI, etc. calls return the actual loaded image. It will try first to load a dv PRJ file and extract the appropriate file from the stack, but if it fails, then it'll try loading the TIF files. This will require finding all of the loads and making sure the appropriate directories are passed to the getter methods so it can load the tifs and return an Image rather than a string.

ryotatheodora commented 1 year ago

Issue solved on Windows. Updated code pushed to branch ryota-main [edit] Reopening to fix further issue

ryotatheodora commented 1 year ago

Code able to run DV files with older experiments, such as M3850 There will be issues running the code with newer version of the experiment like the M2067.

(branch: ryota-main)