[Insight-users] Problems detecting ImageIOBase::MATRIX

Ariel Hernán Curiale curiale at gmail.com
Fri Oct 12 08:38:41 EDT 2012


Thanks Robert for you reply and you are right this type is not defined in the write function (itk 4.2.0 and 4.2.1). How I suspected the problems is in the write function.


Thanks again.
__________________________________
| 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 22:14, robert tamburo escribió:

> According to the Wiki (http://www.itk.org/Wiki/ITK/File_Formats) the NRRD imageIO should support itk::ImageIOBase::MATRIX. 
> 
> From the source of NrrdImageIO, it appears that itk::ImageIOBase::MATRIX is not defined and defaults to VECTOR.
> 
> 
> Read function:
> case nrrdKindHSVColor:
> case nrrdKindXYZColor:
> case nrrdKindQuaternion:
> case nrrdKind2DSymMatrix:
> case nrrdKind2DMaskedSymMatrix:
> case nrrdKind2DMatrix:
> case nrrdKind2DMaskedMatrix:
> case nrrdKind3DMatrix:
> // for all other Nrrd kinds, we punt and call it a vector
> this->SetPixelType( ImageIOBase::VECTOR );
> this->SetNumberOfComponents(size);
> break;
> 
> Write function (no case for MATRIX):
> case ImageIOBase::VECTOR:
> case ImageIOBase::OFFSET: // HEY is this right?
> case ImageIOBase::FIXEDARRAY: // HEY is this right?
> default:
> kind[0] = nrrdKindVector;
> break;
> 
> 
> On Thu, Oct 11, 2012 at 2:09 PM, Ariel Hernán Curiale <curiale at gmail.com> wrote:
> I found in the header of the images that have the same type of kinds (kinds: vector domain domain ).  I can read both images but I need to force the type (Vector or Matrix).
> According to the .nrrd definition the kinds of the image (Matrix) must not be a matrix ?
> 
> Saludos
> __________________________________
> | 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:19, Ariel Hernán Curiale escribió:
> 
>> 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
>>> |_________________________________
>>> 
>> 
> 
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
> 
> -- 
> robert
> 

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


More information about the Insight-users mailing list