[Insight-users] How to get gradient vector image?

David Doria daviddoria at gmail.com
Thu Apr 7 11:15:43 EDT 2011


On Thu, Apr 7, 2011 at 11:10 AM, Melanie Uks <meluks2010 at googlemail.com> wrote:
> I tried to design an example for the GradientRecursiveGaussianImageFilter.
> Now I have a problem finding a file format for the
> "CovariantVector"-OutputImage. I tried to use nrrd :
>
>     itk::NrrdImageIO::Pointer io = itk::NrrdImageIO::New();
>     //io->SetNrrdVectorType( nrrdKindList );
>     io->SetFileType( itk::ImageIOBase::ASCII );
>
>     //create the reader and writer
>      ReaderType::Pointer reader = ReaderType::New();
>      WriterType::Pointer nrrdWriter = WriterType::New();
>
>     //recover file names from command line arguments
>     const char * inputFilename  = argv[1];
>     const char * outputFilename = argv[2];
>
>     reader->SetFileName( inputFilename  );
>     nrrdWriter->UseInputMetaDataDictionaryOn();
>     nrrdWriter->SetImageIO(io);
>     nrrdWriter->SetFileName(outputFilename);
>
>     //  processing pipeline:
>     filter->SetInput( reader->GetOutput() );
>     nrrdWriter->SetInput( filter->GetOutput() );
>
>     try
>     {
>         //execute the pipeline
>         nrrdWriter->Update();
>     }
>     catch( itk::ExceptionObject & err )
>     {
>         std::cerr << "ExceptionObject caught !" << std::endl;
>         std::cerr << err << std::endl;
>         return EXIT_FAILURE;
>     }
>
> This didn't work! I guess the following part would help (copied from here)
>
>   itk::NrrdImageIO::Pointer io = itk::NrrdImageIO::New();
>   // This statement is to be added to the ITK CVS Release
>   io->SetNrrdVectorType( nrrdKindList );
>   io->SetFileType( itk::ImageIOBase::ASCII );
>
> But it was not possible because "SetNrrdVectorType" does not exist...
>
> Anyway: is there a file format to save vector images and how to do???
>
> Thanks for your help!
>
> Melanie

Melanie,

Just use the ImageFileWriter and give it a filename ending in .mhd.
This is the Meta format. It can be opened in Paraview.

http://www.itk.org/Wiki/ITK/Examples/IO/ImageFileWriter

David


More information about the Insight-users mailing list