[Insight-users] new filetype reader

Jesse C Cronce croncejc at mrctr.upmc.edu
Wed Oct 5 11:41:28 EDT 2005


All,

    I am developing a file reader for a new file type. The data in the
file is time series image data which has been FFTransformed. What I am
trying to do is inverse fourier the data, and then dump it out into an
analyze (or any of the other supported file formats) file. 

Unfortunately I am running into some difficulty. I have attached a
sample program and the compiler output. It appears as though I cannot
use std::complex< float> as the pixel type, which is what p309 of the
manual http://www.itk.org/ItkSoftwareGuide.pdf seems to indicate should
be fine.

My ITK version is 2.0.1.

Sorry for such a basic question. I'm an ITK noob.

Thanks in advance for all the help!
JCC

---VVV---   PROGRAM   ---VVV---

#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkImage.h"
#include "itkSiscoImageIO.h"
#include "itkSiscoImageIOFactory.h"
#include "itkVnlFFTComplexConjugateToRealImageFilter.h"
#include "itkVnlFFTRealToComplexConjugateImageFilter.h"
#include "itkImageRegionIterator.h"

using namespace itk;

int main( int argc, char ** argv )
{

    itk::ObjectFactoryBase::RegisterFactory
( itk::SiscoImageIOFactory::New() );

    // Verify the number of parameters in the command line
    if( argc < 3 )
    {
        std::cerr << "Usage: " << std::endl;
        std::cerr << argv[0] << " inputImageFile outputImageFile " <<
std::endl;        return -1;
    }

    typedef std::complex< float > CPixelType;
    typedef float RPixelType;
    const unsigned int Dimension = 3;
    typedef itk::Image< CPixelType, Dimension > CompImageType;
    typedef itk::Image< RPixelType, Dimension > RealImageType;

    typedef itk::ImageFileReader< CompImageType >  ReaderType;
    typedef itk::ImageFileWriter< RealImageType >  WriterType;

    typedef itk::VnlFFTComplexConjugateToRealImageFilter< RPixelType,
        Dimension > iffttype;

    ReaderType::Pointer reader = ReaderType::New();
    WriterType::Pointer writer = WriterType::New();
    iffttype::Pointer C2R = iffttype::New();

    const char * inputFilename  = argv[1];
    const char * outputFilename = argv[2];

    reader->SetFileName( inputFilename  );
    writer->SetFileName( outputFilename );

    C2R->SetInput( reader->GetOutput() );    try
    {
        C2R->Update();
    }
    catch( itk::ExceptionObject & err )
    {
        std::cout << "ExceptionObject caught !" << std::endl;
        std::cout << err << std::endl;
        return -1;
    }

    writer->SetInput( C2R->GetOutput() );

    try
    {
        writer->Update();
    }
    catch( itk::ExceptionObject & err )
    {
        std::cout << "ExceptionObject caught !" << std::endl;
        std::cout << err << std::endl;
        return -1;
    }

    return 0;
}


---VVV---   OUTPUT HERE   ---VVV---

Script started on Wed 05 Oct 2005 11:29:59 AM EDT
linux^M
~/MRRC_SRC/tmp> make^M^M
g++ -g -Wall -g -I/usr/openwin/include -I/usr/local/include -
I/usr/freeware/include/mysql -I../common -
I/usr/local/include/InsightToolkit/IO/ -
I/usr/local/include/InsightToolkit/ -
I/usr/local/include/InsightToolkit/Common/ -
I/usr/local/include/InsightToolkit/Algorithms/ -
I/usr/local/include/InsightToolkit/Utilities/vxl/vcl/ -
I/usr/local/include/InsightToolkit/Utilities/vxl/core -
I/usr/local/include/InsightToolkit/Utilities/ -c SiscoToAnalyze.C ^M
/usr/local/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h: In
instantiation of `itk::DefaultConvertPixelTraits<main(int,
char**)::CPixelType>':^M
/usr/local/include/InsightToolkit/IO/itkImageFileReader.txx:308:
instantiated from `void itk::ImageFileReader<TOutputImage,
ConvertPixelTraits>::GenerateData() [with TOutputImage = main(int,
char**)::CompImageType, ConvertPixelTraits =
itk::DefaultConvertPixelTraits<main(int, char**)::CPixelType>]'^M
SiscoToAnalyze.C:45:   instantiated from here^M
/usr/local/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h:43:
error: no type named `ComponentType' in `class main(int,
char**)::CPixelType'^M
/usr/local/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h:51:
error: no type named `ComponentType' in `class main(int,
char**)::CPixelType'^M
/usr/local/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h:55:
error: no type named `ComponentType' in `class main(int,
char**)::CPixelType'^M
/usr/local/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h:59:
error: no type named `ComponentType' in `class main(int,
char**)::CPixelType'^M
/usr/local/include/InsightToolkit/IO/itkImageFileReader.txx: In member
function `void itk::ImageFileReader<TOutputImage,
ConvertPixelTraits>::GenerateData() [with TOutputImage = main(int,
char**)::CompImageType, ConvertPixelTraits =
itk::DefaultConvertPixelTraits<main(int, char**)::CPixelType>]':^M
SiscoToAnalyze.C:45:   instantiated from here^M
/usr/local/include/InsightToolkit/IO/itkImageFileReader.txx:308: error:
no type named `ComponentType' in `class
itk::DefaultConvertPixelTraits<main(int, char**)::CPixelType>'^M
SiscoToAnalyze.C:45:   instantiated from here^M
/usr/local/include/InsightToolkit/IO/itkImageFileReader.txx:329: error:
no type named `ComponentType' in `class
itk::DefaultConvertPixelTraits<main(int, char**)::CPixelType>'^M
/usr/local/include/InsightToolkit/Common/itkImageBase.txx: In member
function `void itk::ImageBase<VImageDimension>::ComputeOffsetTable()
[with unsigned int VImageDimension = 3u]':^M
/usr/local/include/InsightToolkit/Common/itkImageBase.txx:309:
instantiated from `void
itk::ImageBase<VImageDimension>::SetBufferedRegion(const
itk::ImageRegion<VImageDimension>&) [with unsigned int VImageDimension =
3u]'^M
SiscoToAnalyze.C:45:   instantiated from here^M
/usr/local/include/InsightToolkit/Common/itkImageBase.txx:135: warning:
long int format, unsigned int arg (arg 2)^M
/usr/local/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h: In
static member function `static unsigned int
itk::DefaultConvertPixelTraits<PixelType>::GetNumberOfComponents() [with
PixelType = main(int, char**)::CPixelType]':^M

(and it keeps on going and going. If more is needed, please ask)




More information about the Insight-users mailing list