[Insight-users] Problems detecting ImageIOBase::MATRIX

Ariel Hernán Curiale curiale at gmail.com
Thu Oct 11 12:19:59 EDT 2012


Anyone know what I'm doing wrong ?

__________________________________
| Ariel Hernán Curiale Ph.D Student
| ETSI Telecomunicación
| Universidad de Valladolid
| Campus Miguel Delibes
| 47011 Valladolid, Spain
| Phone: 983-423000 ext. 5590
| Web: www.curiale.com.ar
|_________________________________

El 11/10/2012, a las 18:05, Ariel Hernán Curiale escribió:

> Hi,
> 
> I'm trying to detect  if the PixelType of an image is a Vector or a Matrix with this code:
> 
> itk::ImageIOBase::Pointer fieldIO;
> itk::ImageIOBase::IOPixelType pixelType;
> fieldIO = itk::ImageIOFactory::CreateImageIO(fieldPathFile.c_str(), itk::ImageIOFactory::ReadMode);
> fieldIO->SetFileName("field.nrrd");
> fieldIO->ReadImageInformation();
> pixelType = fieldIO->GetPixelType();
> 
> switch(pixelType)
> 	{
>  	case itk::ImageIOBase::MATRIX:
> 		std::cout<<"Matrix....."<<std::endl;
> 	        break;
>         case itk::ImageIOBase::VECTOR:
> 		std::cout<<"Vector....."<<std::endl;
>                 break;
> 	default:
>       		std::cerr << "PixelType unsupported." << std::endl;
>       		return EXIT_FAILURE;
>     }
> 
> 
> 
> The field.nrrd was write  using this code:
> 
> 1) Vector:
> typedef itk::Image< itk::Vector<float,3>,3> DeformationFieldType;
> typedef itk::ImageFileWriter<DeformationFieldType> FieldWriterType;
>       typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();
>       fieldWriter->SetInput(deformationField);
>       fieldWriter->SetFileName("fieldVector.nrrd");
>       fieldWriter->Update();
> 
> 2) Matrix:
> typedef itk::Matrix< double, 2, 2 > 	TensorPixelType;
>   typedef itk::Image<TensorPixelType, 2>	StrainImageType;
> typedef itk::ImageFileWriter<typename StrainFilterType::OutputImageType> FieldWriterType;
>       typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();
>       fieldWriter->SetInput(strainFilter->GetStrainTensor());
>       fieldWriter->SetFileName("fieldMatrx.nrrd");
>       fieldWriter->Update();
> 
> 
> But in both case the pixelType is itk::ImageIOBase::VECTOR.
> 
> What I'm doing wrong ?
> 
> Thanks
> __________________________________
> | Ariel Hernán Curiale Ph.D Student
> | ETSI Telecomunicación
> | Universidad de Valladolid
> | Campus Miguel Delibes
> | 47011 Valladolid, Spain
> | Phone: 983-423000 ext. 5590
> | Web: www.curiale.com.ar
> |_________________________________
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121011/d984e5ee/attachment.htm>


More information about the Insight-users mailing list