[Insight-users] Possible bug in itkAnalyzeImageIO? : Gipl not being found

Luis Ibanez luis.ibanez@kitware.com
Fri, 28 Mar 2003 08:28:22 -0500


Hi Raghavendra,

Yeap, the code looks right.

1) Could you post the piece of code you are using for
    reading the gipl file ?

2)  Could you try reading the gipl test file
     that is available in

        Insight/Testing/Data/Baseline/IO

     the file name is

               ramp.gipl

If this test file works, this may mean that there
is something particular in your gipl file that
prevents the reader from recognizing the format.

Note that checking the extension .gipl is only the
initial part of the test. Readers verify the content
of the file in order to make sure they are capable
of processing the file.


Thanks

   Luis


--------------------------

Raghavendra Chandrashekara wrote:
> Hi Luis,
> 
> There is a line registering the GiplImageIOFactory but it is on line 98,
> this is the code:
> 
> void
> ImageIOFactory::RegisterBuiltInFactories()
> {
>   static bool firstTime = true;
> 
>   static SimpleMutexLock mutex;
>   {
>     // This helper class makes sure the Mutex is unlocked
>     // in the event an exception is thrown.
>     MutexLockHolder<SimpleMutexLock> mutexHolder( mutex );
>     if( firstTime )
>       {
>       ObjectFactoryBase::RegisterFactory( DicomImageIOFactory::New() );
>       ObjectFactoryBase::RegisterFactory( MetaImageIOFactory::New() );
>       ObjectFactoryBase::RegisterFactory( PNGImageIOFactory::New() );
>       ObjectFactoryBase::RegisterFactory( VTKImageIOFactory::New() );
>       ObjectFactoryBase::RegisterFactory( GiplImageIOFactory::New() );
>       ObjectFactoryBase::RegisterFactory( AnalyzeImageIOFactory::New());
>       firstTime = false;
>       }
>   }
> 
> }
> 
> Does it look correct to you? I'm using Release-1-2-0 also.
> 
> Thanks,
> 
> Raghavendra.
> 
> ----- Original Message -----
> From: "Luis Ibanez" <luis.ibanez@kitware.com>
> To: "Raghavendra Chandrashekara" <rc3@doc.ic.ac.uk>
> Cc: <insight-users@public.kitware.com>
> Sent: Friday, March 28, 2003 12:31 PM
> Subject: Re: [Insight-users] Possible bug in itkAnalyzeImageIO? : Gipl not
> being found
> 
> 
> 
>>Hi Raghavendra,
>>
>>It looks like the GiplImageIO factory
>>is not being found.
>>
>>Could you please double check the file
>>
>>Insight/Code/IO
>>
>>   itkImageIOFactory.cxx
>>
>>and see if in line 99, the following
>>line is not commented out :
>>
>>
>>  ObjectFactoryBase::RegisterFactory( GiplImageIOFactory::New() );
>>
>>
>>This lines registers the Gipl reader/writer
>>in the factory mechanism.
>>
>>(I'm assuming you are using ITK version 1.2)
>>
>>
>>
>>Regards,
>>
>>
>>
>>Luis
>>
>>
>>---------------------------------------------
>>Raghavendra Chandrashekara wrote:
>>
>>>Hi Kent,
>>>
>>>Okay I tried the patch that you sent. Now another exception is thrown,
>>
> this
> 
>>>time by the itkImageFileReader class:
>>>
>>>Exception object caught!
>>>
>>>itk::ImageFileReaderException (0x815ace8)
>>>Location: "Unknown"
>>>File: /vol/vipdata/packages/InsightCVS/Code/IO/itkImageFileReader.txx
>>>Line: 94
>>>Description:  Could not create IO object for file
>>>../../Data/Synthetic/cube.gipl
>>>
>>>Does this mean that the gipl image is not being recognised by any of the
>>
> IO
> 
>>>classes?
>>>
>>>Raghavendra.
>>>
>>>----- Original Message -----
>>>From: "Kent Williams" <kent@mail.psychiatry.uiowa.edu>
>>>To: "Raghavendra Chandrashekara" <rc3@doc.ic.ac.uk>
>>>Sent: Wednesday, March 19, 2003 6:46 PM
>>>Subject: Re: [Insight-users] Possible bug in itkAnalyzeImageIO?
>>>
>>>
>>>I don't know why you're getting that far into CanRead, since the 1.2
>>
> version
> 
>>>of itkAnalyzeImageIO.cxx checks for valid extensions first before trying
>>
> to
> 
>>>open the file.
>>>
>>>I think that it's incorrect to throw an exception in CanRead anyway; my
>>>suggestion to  you is to patch around line 1000 in that file thusly:
>>>
>>>CHANGE:
>>>    if( local_InputStream.fail() )
>>>      {
>>>        ExceptionObject exception(__FILE__, __LINE__);
>>>        exception.SetDescription("File cannot be read");
>>>        throw exception;
>>>      }
>>>    local_InputStream.read( (char *)&(this->m_hdr), sizeof(struct
>>
> dsr) );
> 
>>>    if( local_InputStream.eof() )
>>>      {
>>>        ExceptionObject exception(__FILE__, __LINE__);
>>>        exception.SetDescription("Unexpected end of file");
>>>        throw exception;
>>>      }
>>>TO:
>>>    if( local_InputStream.fail() )
>>>      {
>>>return false;
>>>      }
>>>    local_InputStream.read( (char *)&(this->m_hdr), sizeof(struct
>>
> dsr) );
> 
>>>    if( local_InputStream.eof() )
>>>      {
>>>return false;
>>>      }
>>>
>>>
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users@public.kitware.com
>>>http://public.kitware.com/mailman/listinfo/insight-users
>>>
>>
>>
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users@public.kitware.com
>>http://public.kitware.com/mailman/listinfo/insight-users
>>
> 
> 
>