Page 1 of 2

BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Wed May 01, 2013 6:25 am
by tom_deschamps
Hi

I installed Bioformats and ITK following the description given in the page http://loci.wisc.edu/bio-formats/itk

(with the difference that the compiler used was /usr/bin/llvm-g++ in order to have python support with itk)

I am trying to read ZVI files in ITK. These files can be loaded in Fiji using the LOCI plugin.

Unfortunately when I try to execute a simple ImageReadWrite on one of these images, bioformats reading gets stuck forever there :

Code: Select all
Debug: In /Users/thomas_deschamps/Dev/bioformats/components/native/bf-itk/itkBioFormatsImageIO.cxx, line 675
BioFormatsImageIO (0x1028faf00): BioFormatsImageIO::Read command: read   /Data/myfile.zvi   0   1388   0   1040   0   1   0   1   0   1


The stack with gdb leads to
Code: Select all
(gdb) backtrace
#0  0x00007fff87e0edf2 in select$DARWIN_EXTSN ()
#1  0x000000010005264a in itksysProcess_WaitForData ()
#2  0x0000000101ba1fb8 in itk::BioFormatsImageIO::Read ()
#3  0x000000010001f08f in itk::ImageFileReader<itk::Image<short, 2u>, itk::DefaultConvertPixelTraits<short> >::GenerateData ()
#4  0x0000000100641186 in itk::ProcessObject::UpdateOutputData ()
#5  0x0000000100020b63 in itk::ImageFileWriter<itk::Image<short, 2u> >::Write ()
#6  0x0000000100015736 in main ()


So if anybody has an idea or a suggestion, it's very welcome.
BTW if you know how to remove all the bioformat debug info, that's good too.
Thanks

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Thu May 02, 2013 1:28 pm
by hinerm
Hi Tom,

So sorry for taking so long to reply to you.

We've been working on improving the integration of Bio-Formats with ITK. There is actually a patch under review that will put the Bio-Formats ITK ImageIO (now called itkSCIFIOImageIO) that includes the update plugin, and within the next few weeks we plan to merge it with ITK.

At that point you'll just download ITK as normal, but I think you'll have to set the ITK_AUTOLOAD_PATH to the SCIFIOImageIO as it won't be loaded by default. Anyway, we'll update the instructions page when it does get released.

In the mean time, you can follow the review process and download the latest patches from: http://review.source.kitware.com/#/c/9450/

As for the actual bug you reported, it sounds like an instance of a known bug resulting from the C++ and Java sides of the plugin calculating different plane sizes, so the C++ side waits for more bytes than the Java side actually reads, resulting in it hanging forever.

I believe the issue is fixed in patch 4 of the itkSCIFIOImageIO.

Patch 4 should be more stable than what you were using, but there are still bugs. So if patch 4 doesn't work for you, I can post instructions for building off my actual development branches (which are more up to date) or I can let you know when the next patch is posted.

If you have any more questions or run into any problems using patch 4, please let me know!

Thanks,
Mark

P.S. As for the debugging output, with the itkSCIFIOImageIO that's all handled through the ITK macro code. I believe you can control it by calling io->DebugOn() or io->DebugOff() after instantiating an imageIO. I'm not as familiar with ITK debugging though so let me know if that doesn't work for you.

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Fri May 03, 2013 3:19 pm
by tom_deschamps
Hi Mark

Apparently this patch does not compile on the dashboard http://open.cdash.org/viewBuildError.ph ... id=2887524
Not on my machine as well.
Cheers

Thomas

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Fri May 03, 2013 5:46 pm
by hinerm
Hi Thomas,

Sorry about that - it was working locally for me. I'll try to get a new patch up next week. In the mean time, you could try patch 3. I believe that had the size mismatch fix (although there may still be other unaddressed issues).

Thanks,
Mark

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Sat May 04, 2013 10:02 am
by tom_deschamps
Hi Mark

I really appreciate your help.
The patch3 compiled but the execution of ImageReadWrite or any other Image* routine led to a segmentation fault.

Code: Select all
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x000000010000e9e3 in itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::GenerateOutputInformation ()


Regards

Thomas

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Sat May 04, 2013 2:23 pm
by hinerm
Hi Thomas,

What are you using to actually open your data? Is it pure ITK code, or another application backed by ITK?

If you build ITK with tests enabled, the SCIFIOImageIO includes a test driver (which builds to your $build/bin directory). You can use the driver to run the tests found here:
https://github.com/hinerm/ITK/tree/scif ... CIFIO/test

The syntax is a little weird: <test driver> <test module> <module args...>

I have to apologize that there is no documentation yet. You may need to edit the test source to specify the component and pixel type of your image. But if you can, try using the itkSCIFIOImageIOTest to read your ZVI data and write it (e.g. as a .tiff).

If that works but your original application doesn't, then there's some deficiency in how the imageIO is being populated. In my development I've been primarily using those test scripts, so there may be other ITK API that isn't supported yet. But I'd definitely like to fix that!

If you have any trouble running the tests let me know, and on Monday I can put out some documentation and/or refactor them to be a bit more user-friendly.

Thanks again,
Mark

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Sun May 05, 2013 5:50 am
by tom_deschamps
Hi Mark

I am just using the ImageReadWrite example that comes with ITK.
I have tried the routines in the module SCIFIO and some of them work fine.

Code: Select all
bin/ITKIOSCIFIOTestDriver itkSCIFIOImageIOTest myImage.zvi myImage.tiff


After changing from unsigned char to unsigned short, I am left with only one channel of my microscopy data (among 3), but at least it works!!!
I guess it should not be too complicated to play with it. But if you have an idea on how I could get all 3 channels in the tiff file, that would be great. I tried with itkRGBSCIFIOImageIOTest but I got 3 identical channels.

Thanks so much

Thomas

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Sun May 05, 2013 1:13 pm
by hinerm
Thomas,

Awesome! Well at least that is a start :)

Hmmm... I actually think there's a bug in the java code regarding how multiple channels are written out. :(
I fixed it in my latest development code, but because it requires some logistic updates to how ITK is downloading the bio-formats jar, it's not going to be fixed until the next patch release.

I'll take a quick look at it tomorrow and if it's a simple fix I can put a up custom jar to tide you over until the next patch release.

I'll take a look at the ITK examples too and iron out any other bugs with the SCIFIOImageIO. Thanks for testing that :)

- Mark

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Sun May 05, 2013 4:17 pm
by tom_deschamps
Hi Mark

The most pressing thing for me would be to be able to read them, not write them
I can provide some zvi data if needed.
Thanks for the help.

Thomas

Re: BioFormats + ITK on Mac: cannot read ZVI data

PostPosted: Tue May 07, 2013 4:03 am
by tom_deschamps
Hi Mark

There is new patch 5 on http://review.source.kitware.com/#/c/9450/
Do you think I should try to work with that one?
Best

Thomas