[Insight-users] Why I can't read vector image?

Luis Ibanez luis.ibanez at kitware.com
Fri, 06 Feb 2004 08:30:49 -0500


Hi Sah,

Thanks for pointing this out.

We reproduced the problem that you reported
and it seems to be a bug in the process of
reading vector images.

This has been entered as Bug # 580 in the bug-tracker
http://www.itk.org/Bug/bug.php?op=show&bugid=580&pos=0

You are welcome to open an account on the bug tracker
if you want to receive updates on the status of this
bug.  No authorization is required for getting an
account on the bug tracker. Simply go to:

         http://www.itk.org/Bug/


Regards,


    Luis


------------------
Sah Rayman wrote:

> Seems I could not read a vector image. I will post my
> code below. Here is the result after I run the code:
> 
> vectread vectors.mhd
> 
>>(-4.31602e+008,-4.31602e+008)
> 
> 
> The vector I read should be (0,0) but the result is
> obviously something else.
> 
> Can someone help?
> 
> Thanks!
> 
> --------DATA FILE----------
> 
> The data file: vectors.mhd
> ObjectType = Image
> NDims = 2
> BinaryData = True
> BinaryDataByteOrderMSB = False
> DimSize = 256 256
> ElementNumberOfChannels = 2
> ElementType = MET_FLOAT
> ElementDataFile = vectors.raw
> 
> vectors.raw is a 524,288 byte all 0x00 raw file. 
> 
> 
> ------SOURCE CODE-----------
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> 
> int main( int argc, char *argv[] ) {
> 
> const unsigned int    Dimension = 2;
> typedef   float       InternalPixelType;
> typedef
> itk::Image<itk::CovariantVector<InternalPixelType,
> Dimension>, Dimension> VectorImageType;
> 
> typedef  itk::ImageFileReader< VectorImageType >
> VectorReaderType;
> 
> VectorReaderType::Pointer vectorImageReader =
> VectorReaderType::New();
> 
> vectorImageReader->SetFileName( argv[1] );
> 
> try {
>     vectorImageReader->Update();
> } 
>   catch( itk::ExceptionObject & excep )
> {
>     std::cerr << "Exception caught !" << std::endl;
>     std::cerr << excep << std::endl;
> }
> 
> 
> VectorImageType::IndexType pixelIndex;
> itk::CovariantVector<InternalPixelType, Dimension>  
> pixelValue;
> 
> pixelIndex[0] = 0; pixelIndex[1] = 0;
> 
> vectorImageReader->Update();
> pixelValue =
>     vectorImageReader->GetOutput()->GetPixel(
> pixelIndex );
> 
> 
> std::cout << "(" << pixelValue[0] << "," <<
> pixelValue[1] << ")" << std::endl;
> 
> return 0;
> }
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>