[Insight-users] Problems with fixedReader->Update();
    Ramón Casero Cañas 
    ramon.casero at comlab.ox.ac.uk
       
    Tue Jul 21 18:02:06 EDT 2009
    
    
  
motes motes wrote:
> Ok the error has been related to this line:
> 
>         fieldWriter->Update();
> 
> all the time, but I still cannot understand why. Have made sure to specify :
> 
>   typedef   unsigned char  PixelType;
> 
> 
>  Any help appreciated!
Hi, I cannot solve the problem, but maybe some indications will help.
Your code is failing because the writer is calling 
PNGImageIO::WriteSlice, and it gets to the following switch statement in 
itkPNGImageIO.cxx:
<CODE>
   switch (this->GetComponentType())
     {
     case UCHAR:
       bitDepth = 8;
       break;
     case USHORT:
       bitDepth = 16;
       break;
     default:
       {
       // [cropped]
       ::itk::ExceptionObject excp(__FILE__, __LINE__, "PNG supports 
unsigned char and unsigned short", ITK_LOCATION);
       throw excp;
       }
     }
</CODE>
The component type is defined in Code/IO/itkImageIOBase.h
<CODE>
   /** Enums used to manipulate the component type. The component type
    * refers to the actual storage class associated with either a
    * SCALAR pixel type or elements of a compound pixel.
    */
   typedef  enum {UNKNOWNCOMPONENTTYPE,UCHAR,CHAR,USHORT,SHORT,UINT,INT,
                  ULONG,LONG, FLOAT,DOUBLE} IOComponentType;
</CODE>
Can you add a line before the switch statement in itkPNGImageIO.cxx
std::cout << "COMPONENT: " << this->GetComponentType() << std::endl;
to see what component type it thinks it is?
Besides, can you submit your code?
Cheers,
R.
-- 
Ramón Casero Cañas, DPhil
Computational Biology, Computing Laboratory
University of Oxford
Wolfson Building, Parks Rd
Oxford OX1 3QD
tlf     +44 (0) 1865 610807
web     http://web.comlab.ox.ac.uk/people/Ramon.CaseroCanas
photos  http://www.flickr.com/photos/rcasero/
    
    
More information about the Insight-users
mailing list