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

mitk::VtkImageReader Class Reference
[IO Classes]

Reader to read image files in vtk file format. More...

#include <mitkVtkImageReader.h>

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

List of all members.

Public Types

typedef VtkImageReader Self
typedef FileReader Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual void SetFileName (const char *_arg)
 Specify the file to load.
virtual const char * GetFileName () const
 Get the specified the file to load.
virtual void SetFilePrefix (const char *_arg)
 Specify file prefix for the file(s) to load.
virtual const char * GetFilePrefix () const
 Get the specified file prefix for the file(s) to load.
virtual void SetFilePattern (const char *_arg)
 Specified file pattern for the file(s) to load. The sprintf format used to build filename from FilePrefix and number.
virtual 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.

Static Public Member Functions

static Pointer New ()
static bool CanReadFile (const std::string filename, const std::string filePrefix, const std::string filePattern)

Protected Member Functions

 VtkImageReader ()
 ~VtkImageReader ()
virtual void GenerateData ()
 A version of GenerateData() specific for image processing filters.

Protected Attributes

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

Detailed Description

Reader to read image files in vtk file format.

Definition at line 30 of file mitkVtkImageReader.h.


Member Typedef Documentation

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

Definition at line 33 of file mitkVtkImageReader.h.

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

Definition at line 33 of file mitkVtkImageReader.h.

Definition at line 33 of file mitkVtkImageReader.h.

Definition at line 33 of file mitkVtkImageReader.h.


Constructor & Destructor Documentation

mitk::VtkImageReader::VtkImageReader (  ) [protected]

Definition at line 24 of file mitkVtkImageReader.cpp.

mitk::VtkImageReader::~VtkImageReader (  ) [protected]

Definition at line 29 of file mitkVtkImageReader.cpp.

{
}

Member Function Documentation

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

Definition at line 67 of file mitkVtkImageReader.cpp.

{
  // First check the extension
  if(  filename == "" )
    return false;

  bool extensionFound = false;
  std::string::size_type PVTKPos = filename.rfind(".pvtk");
  if ((PVTKPos != std::string::npos)
      && (PVTKPos == filename.length() - 5))
    {
    extensionFound = true;
    }

  PVTKPos = filename.rfind(".PVTK");
  if ((PVTKPos != std::string::npos)
      && (PVTKPos == filename.length() - 5))
    {
    extensionFound = true;
    }

  if (extensionFound)
  {
    vtkDataReader *chooser=vtkDataReader::New();
    chooser->SetFileName(filename.c_str() );
    if(!chooser->IsFileStructuredPoints())
      return false;
  }
  else
    return false;

  return true;
}
void mitk::VtkImageReader::GenerateData (  ) [protected, virtual]

A version of GenerateData() specific for image processing filters.

This implementation will split the processing across multiple threads. The buffer is allocated by this method. Then the BeforeThreadedGenerateData() method is called (if provided). Then, a series of threads are spawned each calling ThreadedGenerateData(). After all the threads have completed processing, the AfterThreadedGenerateData() method is called (if provided). If an image processing filter cannot be threaded, the filter should provide an implementation of GenerateData(). That implementation is responsible for allocating the output buffer. If a filter an be threaded, it should NOT provide a GenerateData() method but should provide a ThreadedGenerateData() instead.

See also:
ThreadedGenerateData()

We create a Generic Reader to test de .vtk/

StructuredPoints/

Reimplemented from mitk::ImageSource.

Definition at line 33 of file mitkVtkImageReader.cpp.

References MITK_ERROR, and MITK_INFO.

{
  if( m_FileName != "")
  {
    MITK_INFO << "Loading " << m_FileName << " as vtk" << std::endl;

    vtkDataReader *chooser=vtkDataReader::New();
    chooser->SetFileName(m_FileName.c_str() );

    if(chooser->IsFileStructuredPoints())
    {
      MITK_INFO << "StructuredPoints"<< std::endl;
      vtkStructuredPointsReader *reader=vtkStructuredPointsReader::New();
      reader->SetFileName(m_FileName.c_str());
      reader->Update();

      if ( reader->GetOutput() != NULL )
      {
        mitk::Image::Pointer output = this->GetOutput();
        output->Initialize( reader->GetOutput() );
        output->SetVolume(  reader->GetOutput()->GetScalarPointer());
      }
      reader->Delete();
    }
    else
    {
      MITK_ERROR << " ... sorry, this .vtk format is not supported yet."<<std::endl;
    }
    chooser->Delete();
  }
}
virtual const char* mitk::VtkImageReader::GetClassName (  ) const [virtual]
virtual const char* mitk::VtkImageReader::GetFileName (  ) const [virtual]

Get the specified the file to load.

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

Implements mitk::FileReader.

virtual const char* mitk::VtkImageReader::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.

virtual const char* mitk::VtkImageReader::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.

static Pointer mitk::VtkImageReader::New (  ) [static]

Method for creation through the object factory.

Reimplemented from mitk::ImageSource.

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

Specify the file to load.

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

Implements mitk::FileReader.

virtual void mitk::VtkImageReader::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.

virtual void mitk::VtkImageReader::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.


Member Data Documentation

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

Definition at line 62 of file mitkVtkImageReader.h.

std::string mitk::VtkImageReader::m_FilePattern [protected]

Definition at line 66 of file mitkVtkImageReader.h.

std::string mitk::VtkImageReader::m_FilePrefix [protected]

Definition at line 64 of file mitkVtkImageReader.h.


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