0

I am attempting to implement bio-formats into matlab to run with matlab code the process nd2 microscopy images and quantify them. I am trying to within Matlab directly convert files from nd2>tiff format. If anyone has any guidance as to how I can do this, Please let me know. I have tried using the bfconvert function and it doesn't seem to work. I have also downloaded bftools.zip and bfmatlab.zip.I am wondering if I have to do an integration to allow matlab code to properly function with Java language.

lennon310
  • 12,503
  • 11
  • 43
  • 61
  • MATLAB works fine with Java as it is implemented in BioFormats. There shouldn't be any need to make extra declarations or integrations as long as the .jar file is in the proper location on your machine. Can you provide an example of your code and the error that is generated? – Staus Nov 04 '14 at 23:42
  • Hello Thanks so much for your response. I am new to MATLAB and programming so all of this is confusing me. I basically can not figure out how to convert from nd2>tiff within Bioformats. I know there is code I am suppose to write to be able to do this but I can't figure it out. Please help! – Sibley Bardales Nov 05 '14 at 01:06
  • http://www.openmicroscopy.org/site/support/bio-formats5/developers/matlab-dev.html – Sibley Bardales Nov 05 '14 at 01:07
  • I have been using this.. – Sibley Bardales Nov 05 '14 at 01:08
  • There is a function called bfconvert that is part of the bftools package but it is not a MATLAB file. It is a command-line interface that you call from the command prompt on your machine. This can be called through MATLAB if it has to be, but that is a pretty roundabout way of doing it. According to the documentation it will directly convert your ND2 files into TIFFs and should be pretty fast. If you need to do this in MATLAB (or you want to manipulate the data before saving it as a TIFF) then you can use the bfopen and bfsave tools in the bfmatlab toolbox. – Staus Nov 05 '14 at 02:11
  • Thank you so much for your reply. It means a lot I am terribly frustrated. I have tried this multiple times and it is here where I encounter an error. After using the bfconvert function I encounter an error that says something like this" undefined function bfconvert of type char". I am sure that I am probably doing something trivially wrong I just can't figure out what that is. Seriously Thanks for your replies. Let me know what you think :) – Sibley Bardales Nov 05 '14 at 04:41
  • The error is because bfconvert is not a MATLAB function. It cannot be run through MATLAB without some kludging. It should be run through the Command Prompt on your machine. In Windows, go to the Start Menu, type 'cmd' in the search bar, and hit enter to get to the Command Prompt. From there navigate to the folder that bfconvert is in and try the command that you were trying in MATLAB. – Staus Nov 05 '14 at 05:53
  • Hello THANK SO MUCH! I am in the command window right now and when I try to type in Documents to reach the folder I need , I keep getting an error message saying 'Documents' is not recognized as an internal or external command, etc..... – Sibley Bardales Nov 05 '14 at 19:52
  • hello, I was able to locate the file..where do I type in the bfconvert function in the command window? It still produced an error – Sibley Bardales Nov 05 '14 at 21:25
  • To change directories in the command prompt, you have to put 'cd' in front of the target directory. So to go from C:\Users\Sibley to C:\Users\Sibley\Documents you type 'cd Documents' and hit enter. The prompt should then change to reflect that. Here's a link that shows the procedure: http://coweb.cc.gatech.edu/ice-gt/339 – Staus Nov 05 '14 at 22:16
  • I have a file called 'Sperm in ducts 10x.zvi' in the My Documents folder on my computer. To convert it, I steer the command prompt to the bftools folder (on my machine it's D:\bftools) and type... – Staus Nov 05 '14 at 22:27
  • bfconvert "C:\Users\Staus\Documents\Sperm in ducts 10x.zvi" "C:\Users\Staus\Documents\Coverted.tiff" – Staus Nov 05 '14 at 22:28
  • ...and hit enter. Then Converted.tiff shows up in my My Documents folder and is a multi-layered TIFF file with the data pulled from the .zvi file. The quotes are necessary around the file paths because I have spaces in the names in my file path. – Staus Nov 05 '14 at 22:31
  • Thanks so much for your help. I converted the nd2 file to a tiff file. However, I did this conversion through bioformats and the image even while attempting to pre-process it and adjust the contrats intensity in image J before the image is still dark. If I adjust the contrast in MATLAB using the image viewer app I am having to adjust the minimum and maximum intensity levels of which my data all has different data ranges to which the program I am working on calculates the mean intensity from this alteration, thereby altering my data. What do you recommend so the image won't appear dark? – Sibley Bardales Nov 10 '14 at 06:52
  • I suspect that you have 16-bit image data that is being displayed as 8-bit in ImageJ. As for your analysis - there's no reason you can't take the mean of the image before you scale it for display. – Staus Nov 10 '14 at 22:36
  • Hi , I am working in MATLAB and I have to manually identify the region of intensity because I am looking at a specific border around a cellular structure. Therefore I need to adjust the image to be able to see it so I can quantify the intensity around the border. However, I am still not able to adjust the intensity in MATLAB without changing my data. The only reason I tried using BioFormats was because I was told that since it was a direct way of converting between file formats it could allow me to see the intensity levels without adjusting the data. However, my BIGTIFF is still dark. – Sibley Bardales Nov 11 '14 at 17:52
  • Using `imagesc` in MATLAB rather than `imshow` or `image` will scale the display such that the image should become visible. Alternatively you can alter the images and save new copies, while keeping the originals intact. The regions can be identified and masks generated from the altered images, but the mask applied to the original images to measure the values you are after. – Staus Nov 11 '14 at 22:19

0 Answers0