[ITK] SCIFIO throws exception

Michael Meuli michael.meuli at gmail.com
Fri Apr 11 08:58:45 EDT 2014


Hi Mark,

Could well be a bug in my code. I will have to look at the
itkSCIFIOImageIOTest source. Having a quick look at it, it looks like
I missed quit some things. Thanks for the link.
Anyway for now here my tiny little program (also attached):

#include "itkImage.h"
#include "itkImageFileReader.h"

int main( int argc, char * argv [] )
{

  if( argc < 2 )
    {
    std::cerr << "Missing command line arguments" << std::endl;
    std::cerr << "Usage :  Test input-ome-tiff-ImageFileName " << std::endl;
    return -1;
    }

  typedef unsigned int       PixelType;
  const unsigned int          Dimension = 2;
  typedef itk::Image<PixelType, Dimension > ImageType;

  typedef itk::ImageFileReader< ImageType >  ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
  const char * inputFilename  = argv[1];
  reader->SetFileName( inputFilename );
  try
    {
    reader->Update();
    }
  catch( itk::ExceptionObject & excp )
    {
    std::cerr << "Problem encoutered while reading image file : " <<
argv[1] << std::endl;
    std::cerr << excp << std::endl;
    return -1;
    }
}

Thanks a lot
Michael

On 11 April 2014 14:30, Mark Hiner <hinerm at gmail.com> wrote:
> Hi Michael,
>
>  This is actually potentially some good news.
>
>
>> Description: itk::ERROR: SCIFIOImageIO(0x9fa1ef8): Unknown pixel type: 0
>
>
> This was the bug I found yesterday. It is fixed on the latest master.
>
>
>> Could I set some parameter using the itkSCIFIOImageIOTest utility?
>> Where would I find some information about this?
>
>
> Run itkSCIFIOImageIOTest with no params and it will print out all the
> possible options. You might want to try -w to get it to use the Bio-Formats
> writers for conversion. You also will want to set the # dimensions, pixel
> type, etc.. to match your dataset I believe, which could be why it failed on
> your .jpg.
>
>
>> When I try to explicit instantiate an IO class like e.g.:
>> ImageIOType::Pointer scifioIO = ImageIOType::New();
>> writer->SetImageIO( scifioIO );
>
>
> You might want to take a look at the itkSCIFIOImageIOTest source. It sounds
> like you're trying to do the same thing, right?
>
>> I've rebuilt and get the same error when trying to read the
>> single-channel.ome.tif dataset with my little program which
>
>
> OK! Back to the original problem. So I apologize, but I misunderstood your
> question.. I didn't realize this was coming up in a program you wrote (I
> thought it was in the itkSCIFIOImageIOTest). So can you share the code from
> your program that uses the SCIFIOImageIO? It looks like, however it's being
> used, the Java-side Bio-Formats reader isn't being initialized properly.
> This should be easy to fix, I just need to be able to reproduce the issue,
> to see if it's a bug in your code, or either the C++ or Java portions of the
> SCIFIOImageIO.
>
> Thanks!
> Mark
>
>
> On Fri, Apr 11, 2014 at 12:20 AM, Michael Meuli <michael.meuli at gmail.com>
> wrote:
>>
>> Hi Mark
>>
>> I've rebuilt and get the same error when trying to read the
>> single-channel.ome.tif dataset with my little program which is the
>> same whether JAVA_HOME is unset or set to e.g.
>> "/home/michael/Colocalization/ITK-4.5.1-build/lib/jre":
>>
>> Problem encoutered while reading image file : single-channel.ome.tif
>>
>> itk::ExceptionObject (0x8c280e0)
>> Location: "unknown"
>> File:
>> /home/michael/Colocalization/ITK-4.5.1-build/Modules/Remote/SCIFIO/src/itkSCIFIOImageIO.cxx
>> Line: 180
>> Description: itk::ERROR: SCIFIOImageIO(0x8c26fb0): SCIFIOImageIO
>> exited abnormally. Exception in thread "main"
>> java.lang.IllegalStateException: ImageReader.getSeries: Current file
>> should not be null; call setId(String) first
>> at loci.formats.FormatTools.assertId(FormatTools.java:724)
>> at loci.formats.ImageReader.getReader(ImageReader.java:200)
>> at loci.formats.ImageReader.getSeries(ImageReader.java:441)
>> at loci.formats.ReaderWrapper.getSeries(ReaderWrapper.java:343)
>> at
>> loci.scifio.itk.SCIFIOITKBridge.executeCommand(SCIFIOITKBridge.java:116)
>> at
>> loci.scifio.itk.SCIFIOITKBridge.executeCommand(SCIFIOITKBridge.java:108)
>> at loci.scifio.itk.SCIFIOITKBridge.waitForInput(SCIFIOITKBridge.java:83)
>> at
>> loci.scifio.itk.SCIFIOITKBridge.executeCommand(SCIFIOITKBridge.java:161)
>> at loci.scifio.itk.SCIFIOITKBridge.main(SCIFIOITKBridge.java:693)
>>
>>
>> Trying to read/write the single-channel.ome.tif dataset with the
>> itkSCIFIOImageIOTest utility I get the following error:
>>
>> reader->GetUseStreaming(): 1
>> done checking streaming usage
>> ITK test driver caught an ITK exception:
>>
>> itk::ExceptionObject (0x9faaf70)
>> Location: "unknown"
>> File:
>> /home/michael/Colocalization/ITK-4.5.1-build/Modules/Remote/SCIFIO/src/itkSCIFIOImageIO.cxx
>> Line: 780
>> Description: itk::ERROR: SCIFIOImageIO(0x9fa1ef8): Unknown pixel type: 0
>>
>>
>> Trying to read/write a .jpg file to a .tif file with the
>> itkSCIFIOImageIOTest utility I don't really get an error but a black
>> picture:
>>
>> reader->GetUseStreaming(): 1
>> done checking streaming usage
>> Notes:
>>
>>
>> Could I set some parameter using the itkSCIFIOImageIOTest utility?
>> Where would I find some information about this?
>>
>> When I try to explicit instantiate an IO class like e.g.:
>> ImageIOType::Pointer scifioIO = ImageIOType::New();
>> writer->SetImageIO( scifioIO );
>>
>> I get the following compile time error:
>> 'SCIFIOImageIO' in namespace 'itk' does not name a type
>>    typedef itk::SCIFIOImageIO        ImageIOType
>>
>> Will this be different in ITK 4.6.0? (as I can see it there in Doxygen
>> but not in ITK 4.5.1)
>>
>>
>> Thanks a lot
>> Michael
>>
>>
>>
>> On 10 April 2014 19:43, Mark Hiner <hinerm at gmail.com> wrote:
>> > Hi Michael,
>> >
>> >  I just updated the Java-side handling of null readers/ids. I couldn't
>> > reproduce your exact issue, but it did look like there was the potential
>> > for
>> > an unintended state that would cause the null id error you said.
>> >
>> >  Could you clear your /build directory and rebuild? (this will trigger a
>> > download of the latest Java code) Then try again with the unset
>> > JAVA_HOME.
>> >
>> >> /home/michael/Colocalization/ITK-4.5.1-build/lib/jre/bin
>> >
>> >
>> > As a side note, I believe you need to set JAVA_HOME to the base of your
>> > java
>> > directory (e.g. just
>> > "/home/michael/Colocalization/ITK-4.5.1-build/lib/jre"). At least on OSX
>> > 10.8.5, if I set include the /bin sub-directory, it doesn't actually
>> > discover Java (slightly counter-intuitive if you're used to adding stuff
>> > to
>> > your PATH). So you could try again with the distributed JRE as well.
>> >
>> >  For what it's worth, I am able to read/write the single-channel.ome.tif
>> > dataset with the itkSCIFIOImageIOTest utility, on OSX with java
>> > 1.6.0_45.
>> >
>> > Let us know how it goes!
>> >
>> > Thanks,
>> > Mark
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Apr 10, 2014 at 11:48 AM, Mark Hiner <hinerm at gmail.com> wrote:
>> >>
>> >> Hi Michael,
>> >>
>> >>
>> >>> I guess I just have to install the appropriate plug-in, as my format
>> >>> is not listed here:
>> >>> https://github.com/scifio/scifio
>> >>
>> >>
>> >> I just wanted to let you know that the SCIFIOImageIO always checks
>> >> formats
>> >> using Bio-Formats. So there are no extra plugins you need to install;
>> >> you
>> >> were using it correctly (assuming your Java version is compatible).
>> >>
>> >> Anyway, this looks like there could be legitimate bugs coming from Java
>> >> land. I filed an issue for it, although I haven't been able to
>> >> reproduce it
>> >> yet as I am having a completely different issue regarding pixel types
>> >> right
>> >> now.
>> >>
>> >> Once I can better reproduce/resolve these issues I'll let you know.
>> >>
>> >> Thanks,
>> >> Mark
>> >>
>> >>
>> >>
>> >> On Thu, Apr 10, 2014 at 2:42 AM, Michael Meuli
>> >> <michael.meuli at gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi Matt,
>> >>>
>> >>> I'm sorry for my presumably stupid questions.
>> >>> I guess I just have to install the appropriate plug-in, as my format
>> >>> is not listed here:
>> >>> https://github.com/scifio/scifio
>> >>> (Didn't figure out yet how but I guess I eventually will)
>> >>>
>> >>> Best regards and thanks again,
>> >>> Michael
>> >>>
>> >>> On 9 April 2014 22:14, Michael Meuli <michael.meuli at gmail.com> wrote:
>> >>> > Hi Matt,
>> >>> >
>> >>> > If JAVA_HOME is unset:
>> >>> >
>> >>> > Problem encoutered while reading image file : single-channel.ome.tif
>> >>> >
>> >>> > itk::ExceptionObject (0x81520e0)
>> >>> > Location: "unknown"
>> >>> > File:
>> >>> >
>> >>> > /home/michael/Colocalization/ITK-4.5.1-build/Modules/Remote/SCIFIO/src/itkSCIFIOImageIO.cxx
>> >>> > Line: 180
>> >>> > Description: itk::ERROR: SCIFIOImageIO(0x8150fb0): SCIFIOImageIO
>> >>> > exited abnormally. Exception in thread "main"
>> >>> > java.lang.IllegalStateException: ImageReader.getSeries: Current file
>> >>> > should not be null; call setId(String) first
>> >>> > at loci.formats.FormatTools.assertId(FormatTools.java:724)
>> >>> > at loci.formats.ImageReader.getReader(ImageReader.java:200)
>> >>> > at loci.formats.ImageReader.getSeries(ImageReader.java:441)
>> >>> > at loci.formats.ReaderWrapper.getSeries(ReaderWrapper.java:343)
>> >>> > at
>> >>> >
>> >>> > loci.scifio.itk.SCIFIOITKBridge.executeCommand(SCIFIOITKBridge.java:116)
>> >>> > at
>> >>> >
>> >>> > loci.scifio.itk.SCIFIOITKBridge.executeCommand(SCIFIOITKBridge.java:108)
>> >>> > at
>> >>> >
>> >>> > loci.scifio.itk.SCIFIOITKBridge.waitForInput(SCIFIOITKBridge.java:83)
>> >>> > at
>> >>> >
>> >>> > loci.scifio.itk.SCIFIOITKBridge.executeCommand(SCIFIOITKBridge.java:161)
>> >>> > at loci.scifio.itk.SCIFIOITKBridge.main(SCIFIOITKBridge.java:693)
>> >>> >
>> >>> > Thanks,
>> >>> > Michael
>> >>> >
>> >>> > On 8 April 2014 20:19, Matt McCormick <matt.mccormick at kitware.com>
>> >>> > wrote:
>> >>> >> Hi Michael,
>> >>> >>
>> >>> >> If JAVA_HOME is unset?
>> >>> >>
>> >>> >> Thanks,
>> >>> >> Matt
>> >>> >>
>> >>> >> On Tue, Apr 8, 2014 at 1:57 PM, Michael Meuli
>> >>> >> <michael.meuli at gmail.com> wrote:
>> >>> >>> Hi Matt,
>> >>> >>>
>> >>> >>> Thanks a lot.
>> >>> >>> I set JAVA_HOME to
>> >>> >>> "/home/michael/Colocalization/ITK-4.5.1-build/lib/jre/bin" and
>> >>> >>> still
>> >>> >>> get the same error.
>> >>> >>>
>> >>> >>> Thanks again,
>> >>> >>> Michael
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>> >>> On 7 April 2014 22:10, Matt McCormick <matt.mccormick at kitware.com>
>> >>> >>> wrote:
>> >>> >>>> Hi Michael,
>> >>> >>>>
>> >>> >>>> Does it work with the JRE distributed with the module?  I do not
>> >>> >>>> think
>> >>> >>>> Java 8 has been tested yet.
>> >>> >>>>
>> >>> >>>> Thanks,
>> >>> >>>> Matt
>> >>> >>>>
>> >>> >>>> On Mon, Apr 7, 2014 at 3:34 PM, Michael Meuli
>> >>> >>>> <michael.meuli at gmail.com> wrote:
>> >>> >>>>> Hi,
>> >>> >>>>>
>> >>> >>>>> I'm trying to read the test image "single-channel.ome.tif" from
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>> http://www.openmicroscopy.org/site/support/ome-model/ome-tiff/data.html
>> >>> >>>>> JAVA_HOME is set to "/usr/lib/jvm/java-8-oracle/jre/bin/java"
>> >>> >>>>> Running "SCIFIOTestDriver itkSCIFIOImageIOTest" gives me a very
>> >>> >>>>> similar error.
>> >>> >>>>> I'm running Ubuntu 13.10 32bit with ITK-4.5.1
>> >>> >>>>>
>> >>> >>>>> Below is the text of the error message:
>> >>> >>>>>
>> >>> >>>>> Problem encoutered while reading image file :
>> >>> >>>>> /home/michael/Colocalization/Data/single-channel.ome.tif
>> >>> >>>>>
>> >>> >>>>> itk::ExceptionObject (0x8e283f0)
>> >>> >>>>> Location: "unknown"
>> >>> >>>>> File:
>> >>> >>>>>
>> >>> >>>>> /home/michael/Colocalization/ITK-4.5.1-build/Modules/Remote/SCIFIO/src/itkSCIFIOImageIO.cxx
>> >>> >>>>> Line: 408
>> >>> >>>>> Description: itk::ERROR: SCIFIOImageIO(0x8e27000):
>> >>> >>>>> SCIFIOImageIO:
>> >>> >>>>> ITKReadImageInformation error:
>> >>> >>>>> Not a directory
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>> Many thanks
>> >>> >>>>> Michael
>> >>> >>>>>
>> >>> >>>>> _______________________________________________
>> >>> >>>>> Community mailing list
>> >>> >>>>> Community at itk.org
>> >>> >>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>> >>> >>>>>
>> >>
>> >>
>> >>
>> >
>
>
-------------- next part --------------
cmake_minimum_required(VERSION 2.6)
 
PROJECT(Test)
 
FIND_PACKAGE(ITK REQUIRED SCIFIO)
INCLUDE(${ITK_USE_FILE})
 
if(NOT SCIFIO_LOADED)
  message(FATAL_ERROR "SCIFIO module is required but not available.")
endif()
 
ADD_EXECUTABLE(Test Test.cxx)
TARGET_LINK_LIBRARIES(Test ${ITK_LIBRARIES})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.cxx
Type: text/x-c++src
Size: 845 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140411/b7cd7b55/attachment-0002.cxx>


More information about the Community mailing list