[Insight-users] Reading complex data
    Julien Michel 
    julien.michel at c-s.cnes.fr
       
    Mon Mar 17 11:03:46 EDT 2008
    
    
  
Dear itk developpers,
If you try to read a complex image into an 
itk::Image<std::complex<ValueType> >, you will get a blank (still 
complex) image.
In fact, the itk::ImageFileReader is calling DoConvertBuffer(...) to 
convert the buffer from ValueType * to std::complex<ValueType> *.
This method uses the itk::ConvertPixelBuffer object to perform the 
conversion.
This object has a Convert(...) method, which handles the conversion 
cases, depending on the input and output number of components. The cases 
where input or/and output number of components is 2 is not handled in 
the switch() case: blocks, so the conversion is not made.
The solution would be to enrich the swith()case: block with the cases 
with two components, and write the corresponding convert method, for 
instance :
ConvertComplexToComplex(...);
ConvertMultiComponentToComplex(...);
I did try it, and it seems to work. Of course I can develop my own 
ConvertPixelBuffer object and pass it to the ImageFileReader (second 
template), but I think it will benefit to all itk users if this code is 
integrated into the official itk repository.
I can provide the modified itkConvertPixelBuffer.* files for you to test 
  and integrate if you want.
Best regards,
Julien Michel
    
    
More information about the Insight-users
mailing list