Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

mitk::NrrdQBallImageReader Class Reference

#include <mitkNrrdQBallImageReader.h>

Inheritance diagram for mitk::NrrdQBallImageReader:
Inheritance graph
[legend]
Collaboration diagram for mitk::NrrdQBallImageReader:
Collaboration graph
[legend]

List of all members.

Public Types

typedef mitk::QBallImage OutputType
typedef mitk::QBallImageSource QBImgSourceType
typedef NrrdQBallImageReader Self
typedef QBImgSourceType Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
const char * GetFileName () const
 Get the specified the file to load.
void SetFileName (const char *aFileName)
 Specify the file to load.
const char * GetFilePrefix () const
 Get the specified file prefix for the file(s) to load.
void SetFilePrefix (const char *aFilePrefix)
 Specify file prefix for the file(s) to load.
const char * GetFilePattern () const
 Get the specified file pattern for the file(s) to load. The sprintf format used to build filename from FilePrefix and number.
void SetFilePattern (const char *aFilePattern)
 Specified file pattern for the file(s) to load. The sprintf format used to build filename from FilePrefix and number.

Static Public Member Functions

static Pointer New ()
 Method for creation through the object factory.
static bool CanReadFile (const std::string filename, const std::string filePrefix, const std::string filePattern)

Protected Member Functions

virtual void GenerateData ()
virtual void GenerateOutputInformation ()

Protected Attributes

std::string m_FileName
std::string m_FilePrefix
std::string m_FilePattern

Detailed Description

Definition at line 35 of file mitkNrrdQBallImageReader.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::NrrdQBallImageReader::ConstPointer

Reimplemented from mitk::QBallImageSource.

Definition at line 42 of file mitkNrrdQBallImageReader.h.

Definition at line 39 of file mitkNrrdQBallImageReader.h.

typedef itk::SmartPointer<Self> mitk::NrrdQBallImageReader::Pointer

Reimplemented from mitk::QBallImageSource.

Definition at line 42 of file mitkNrrdQBallImageReader.h.

Definition at line 40 of file mitkNrrdQBallImageReader.h.

Reimplemented from mitk::QBallImageSource.

Definition at line 42 of file mitkNrrdQBallImageReader.h.

Reimplemented from mitk::QBallImageSource.

Definition at line 42 of file mitkNrrdQBallImageReader.h.


Member Function Documentation

bool mitk::NrrdQBallImageReader::CanReadFile ( const std::string  filename,
const std::string  filePrefix,
const std::string  filePattern 
) [static]

Definition at line 140 of file mitkNrrdQBallImageReader.cpp.

  {
    // First check the extension
    if(  filename == "" )
    {
      return false;
    }
    std::string ext = itksys::SystemTools::GetFilenameLastExtension(filename);
    ext = itksys::SystemTools::LowerCase(ext);

    if (ext == ".hqbi" || ext == ".qbi")
    {
      return true;
    }

    return false;
  }
void mitk::NrrdQBallImageReader::GenerateData (  ) [protected, virtual]

Does the real work.

Reimplemented from mitk::ImageSource.

Definition at line 31 of file mitkNrrdQBallImageReader.cpp.

  {    
    if ( m_FileName == "") 
    {
      throw itk::ImageFileReaderException(__FILE__, __LINE__, "Sorry, the filename of the vessel tree to be read is empty!");
    }
    else
    {
      try
      {
        typedef itk::VectorImage<float,3> ImageType;
        itk::NrrdImageIO::Pointer io = itk::NrrdImageIO::New();
        typedef itk::ImageFileReader<ImageType> FileReaderType;
        FileReaderType::Pointer reader = FileReaderType::New();
        reader->SetImageIO(io);
        reader->SetFileName(this->m_FileName);
        reader->Update();
        ImageType::Pointer img = reader->GetOutput();

        typedef itk::Image<itk::Vector<float,QBALL_ODFSIZE>,3> VecImgType;
        VecImgType::Pointer vecImg = VecImgType::New();
        vecImg->SetSpacing( img->GetSpacing() );   // Set the image spacing
        vecImg->SetOrigin( img->GetOrigin() );     // Set the image origin
        vecImg->SetDirection( img->GetDirection() );  // Set the image direction
        vecImg->SetLargestPossibleRegion( img->GetLargestPossibleRegion());
        vecImg->SetBufferedRegion( img->GetLargestPossibleRegion() );
        vecImg->Allocate();

        itk::ImageRegionIterator<VecImgType> ot (vecImg, vecImg->GetLargestPossibleRegion() );
        ot = ot.Begin();

        itk::ImageRegionIterator<ImageType> it (img, img->GetLargestPossibleRegion() );

        typedef ImageType::PixelType  VarPixType;
        typedef VecImgType::PixelType FixPixType;

        for (it = it.Begin(); !it.IsAtEnd(); ++it)
        {
          VarPixType vec = it.Get();
          FixPixType fixVec(vec.GetDataPointer());
          ot.Set(fixVec);
          ++ot;
        }

        this->GetOutput()->InitializeByItk(vecImg.GetPointer());
        this->GetOutput()->SetVolume(vecImg->GetBufferPointer());

      }
      catch(std::exception& e)
      {
        throw itk::ImageFileReaderException(__FILE__, __LINE__, e.what());                    
      }
      catch(...)
      {
        throw itk::ImageFileReaderException(__FILE__, __LINE__, "Sorry, an error occurred while reading the requested vessel tree file!");
      }
    }
  }
void mitk::NrrdQBallImageReader::GenerateOutputInformation ( void   ) [protected, virtual]

Definition at line 90 of file mitkNrrdQBallImageReader.cpp.

  {

  }
virtual const char* mitk::NrrdQBallImageReader::GetClassName (  ) const [virtual]

Reimplemented from mitk::QBallImageSource.

const char * mitk::NrrdQBallImageReader::GetFileName (  ) const [virtual]

Get the specified the file to load.

Either the FileName or FilePrefix plus FilePattern are used to read.

Implements mitk::FileReader.

Definition at line 98 of file mitkNrrdQBallImageReader.cpp.

  {
    return m_FileName.c_str();
  }
const char * mitk::NrrdQBallImageReader::GetFilePattern (  ) const [virtual]

Get the specified file pattern for the file(s) to load. The sprintf format used to build filename from FilePrefix and number.

You should specify either a FileName or FilePrefix. Use FilePrefix if the data is stored in multiple files.

Implements mitk::FileReader.

Definition at line 126 of file mitkNrrdQBallImageReader.cpp.

  {
    return m_FilePattern.c_str();
  }
const char * mitk::NrrdQBallImageReader::GetFilePrefix (  ) const [virtual]

Get the specified file prefix for the file(s) to load.

You should specify either a FileName or FilePrefix. Use FilePrefix if the data is stored in multiple files.

Implements mitk::FileReader.

Definition at line 112 of file mitkNrrdQBallImageReader.cpp.

  {
    return m_FilePrefix.c_str();
  }
static Pointer mitk::NrrdQBallImageReader::New (  ) [static]

Method for creation through the object factory.

Reimplemented from mitk::QBallImageSource.

void mitk::NrrdQBallImageReader::SetFileName ( const char *  aFileName ) [virtual]

Specify the file to load.

Either the FileName or FilePrefix plus FilePattern are used to read.

Implements mitk::FileReader.

Definition at line 105 of file mitkNrrdQBallImageReader.cpp.

  {
    m_FileName = aFileName;
  }
void mitk::NrrdQBallImageReader::SetFilePattern ( const char *  aFilePattern ) [virtual]

Specified file pattern for the file(s) to load. The sprintf format used to build filename from FilePrefix and number.

You should specify either a FileName or FilePrefix. Use FilePrefix if the data is stored in multiple files.

Implements mitk::FileReader.

Definition at line 133 of file mitkNrrdQBallImageReader.cpp.

  {
    m_FilePattern = aFilePattern;
  }
void mitk::NrrdQBallImageReader::SetFilePrefix ( const char *  aFilePrefix ) [virtual]

Specify file prefix for the file(s) to load.

You should specify either a FileName or FilePrefix. Use FilePrefix if the data is stored in multiple files.

Implements mitk::FileReader.

Definition at line 119 of file mitkNrrdQBallImageReader.cpp.

  {
    m_FilePrefix = aFilePrefix;
  }

Member Data Documentation

std::string mitk::NrrdQBallImageReader::m_FileName [protected]

Definition at line 60 of file mitkNrrdQBallImageReader.h.

Definition at line 62 of file mitkNrrdQBallImageReader.h.

Definition at line 61 of file mitkNrrdQBallImageReader.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines