Reader to read unstructured grid files in vtk-format. More...
#include <mitkVtkUnstructuredGridReader.h>


Public Types | |
| typedef VtkUnstructuredGridReader | Self |
| typedef UnstructuredGridSource | Superclass |
| typedef itk::SmartPointer< Self > | Pointer |
| typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| virtual void | SetFileName (const char *_arg) |
| virtual const char * | GetFileName () const |
| virtual void | SetFilePrefix (const char *_arg) |
| virtual const char * | GetFilePrefix () const |
| virtual void | SetFilePattern (const char *_arg) |
| virtual const char * | GetFilePattern () const |
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 | |
| virtual void | GenerateData () |
| VtkUnstructuredGridReader () | |
| ~VtkUnstructuredGridReader () | |
Protected Attributes | |
| std::string | m_FileName |
| std::string | m_FilePrefix |
| std::string | m_FilePattern |
Reader to read unstructured grid files in vtk-format.
Definition at line 28 of file mitkVtkUnstructuredGridReader.h.
| typedef itk::SmartPointer<const Self> mitk::VtkUnstructuredGridReader::ConstPointer |
Reimplemented from mitk::UnstructuredGridSource.
Definition at line 31 of file mitkVtkUnstructuredGridReader.h.
| typedef itk::SmartPointer<Self> mitk::VtkUnstructuredGridReader::Pointer |
Reimplemented from mitk::UnstructuredGridSource.
Definition at line 31 of file mitkVtkUnstructuredGridReader.h.
Reimplemented from mitk::UnstructuredGridSource.
Definition at line 31 of file mitkVtkUnstructuredGridReader.h.
Reimplemented from mitk::UnstructuredGridSource.
Definition at line 31 of file mitkVtkUnstructuredGridReader.h.
| mitk::VtkUnstructuredGridReader::VtkUnstructuredGridReader | ( | ) | [protected] |
Definition at line 27 of file mitkVtkUnstructuredGridReader.cpp.
: m_FileName("") { }
| mitk::VtkUnstructuredGridReader::~VtkUnstructuredGridReader | ( | ) | [protected] |
Definition at line 32 of file mitkVtkUnstructuredGridReader.cpp.
{
}
| bool mitk::VtkUnstructuredGridReader::CanReadFile | ( | const std::string | filename, |
| const std::string | filePrefix, | ||
| const std::string | filePattern | ||
| ) | [static] |
Definition at line 96 of file mitkVtkUnstructuredGridReader.cpp.
{
// First check the extension
if( filename == "" )
return false;
std::string ext = itksys::SystemTools::GetFilenameLastExtension(filename);
ext = itksys::SystemTools::LowerCase(ext);
if (ext == ".vtk")
{
vtkDataReader *chooser=vtkDataReader::New();
chooser->SetFileName(filename.c_str() );
if(!chooser->IsFileUnstructuredGrid())
{
chooser->Delete();
return false;
}
}
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
else
if (ext == ".vtu")
{
vtkXMLUnstructuredGridReader *chooser=vtkXMLUnstructuredGridReader::New();
if(!chooser->CanReadFile(filename.c_str()))
{
chooser->Delete();
return false;
}
}
#endif
else
return false;
return true;
}
| void mitk::VtkUnstructuredGridReader::GenerateData | ( | ) | [protected, virtual] |
We create a Generic Reader to test de .vtk/
UnstructuredGrid/
Definition at line 36 of file mitkVtkUnstructuredGridReader.cpp.
References MITK_INFO.
{
if( m_FileName != "")
{
bool success = false;
MITK_INFO << "Loading " << m_FileName << " as vtk unstructured grid" << std::endl;
std::string ext = itksys::SystemTools::GetFilenameLastExtension(m_FileName);
ext = itksys::SystemTools::LowerCase(ext);
if (ext == ".vtk")
{
vtkDataReader *chooser=vtkDataReader::New();
chooser->SetFileName(m_FileName.c_str() );
if( chooser->IsFileUnstructuredGrid())
{
itkDebugMacro( << "UnstructuredGrid" );
vtkUnstructuredGridReader *reader = vtkUnstructuredGridReader::New();
reader->SetFileName( m_FileName.c_str() );
reader->Update();
if ( reader->GetOutput() != NULL )
{
mitk::UnstructuredGrid::Pointer output = this->GetOutput();
output->SetVtkUnstructuredGrid( reader->GetOutput() );
success = true;
}
reader->Delete();
}
}
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
else
if (ext == ".vtu")
{
vtkXMLUnstructuredGridReader *reader=vtkXMLUnstructuredGridReader::New();
if( reader->CanReadFile(m_FileName.c_str()) )
{
itkDebugMacro( << "XMLUnstructuredGrid" );
reader->SetFileName( m_FileName.c_str() );
reader->Update();
if ( reader->GetOutput() != NULL )
{
mitk::UnstructuredGrid::Pointer output = this->GetOutput();
output->SetVtkUnstructuredGrid( reader->GetOutput() );
success = true;
}
reader->Delete();
}
}
#endif
if(!success)
{
itkExceptionMacro( << " ... sorry, this .vtk format is not supported yet." );
}
}
}
| virtual const char* mitk::VtkUnstructuredGridReader::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::UnstructuredGridSource.
| virtual const char* mitk::VtkUnstructuredGridReader::GetFileName | ( | ) | const [virtual] |
| virtual const char* mitk::VtkUnstructuredGridReader::GetFilePattern | ( | ) | const [virtual] |
| virtual const char* mitk::VtkUnstructuredGridReader::GetFilePrefix | ( | ) | const [virtual] |
| static Pointer mitk::VtkUnstructuredGridReader::New | ( | ) | [static] |
Method for creation through the object factory.
Reimplemented from mitk::UnstructuredGridSource.
Referenced by mitkUnstructuredGridVtkWriterTest().
| virtual void mitk::VtkUnstructuredGridReader::SetFileName | ( | const char * | _arg ) | [virtual] |
| virtual void mitk::VtkUnstructuredGridReader::SetFilePattern | ( | const char * | _arg ) | [virtual] |
| virtual void mitk::VtkUnstructuredGridReader::SetFilePrefix | ( | const char * | _arg ) | [virtual] |
std::string mitk::VtkUnstructuredGridReader::m_FileName [protected] |
Definition at line 54 of file mitkVtkUnstructuredGridReader.h.
std::string mitk::VtkUnstructuredGridReader::m_FilePattern [protected] |
Definition at line 54 of file mitkVtkUnstructuredGridReader.h.
std::string mitk::VtkUnstructuredGridReader::m_FilePrefix [protected] |
Definition at line 54 of file mitkVtkUnstructuredGridReader.h.
1.7.2