SMILX  1.01
Public Slots | Public Member Functions | Protected Attributes | List of all members
milxQtFile Class Reference

This class represents the MILX Qt File I/O object using VTK/ITK/Qt. More...

#include <milxQtFile.h>

Inheritance diagram for milxQtFile:

Public Slots

QString supportedImageFormats ()
 Returns a string of supported image formats from all libraries for in file dialogs in Qt. More...
 
bool is8BitFormat (const QString filename, bool &errorEncountered)
 Returns if a image is an 8-bit image format or not. More...
 
bool is32BitFormat (const QString filename, bool &errorEncountered)
 Returns if a image is an 32-bit image format or not. More...
 
bool isFieldFormat (const QString filename, bool &errorEncountered)
 Returns if a image is a deformation field type image (a vector image) format or not. More...
 
bool openImage (const QString filename, vtkImageData *data)
 Opens an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc. More...
 
bool openImage (const QString filename, milxQtImage *data)
 Opens an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc. Overloaded for milxQtImage. More...
 
bool openImageSeries (milxQtImage *data, QString directoryPath="")
 Opens an DICOM series. More...
 
bool saveImage (const QString filename, vtkImageData *data)
 Saves data as an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc. More...
 
bool saveImage (const QString filename, milxQtImage *data)
 Saves data as an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc. Overloaded for milxQtImage. More...
 
bool openModel (const QString filename, vtkPolyData *data)
 Opens a model file, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk), a Polygonal File (*.ply) or a Object file (*.obj). More...
 
bool openModel (const QString filename, milxQtModel *data)
 Opens a model file, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk), a Polygonal File (*.ply) or a Object file (*.obj). More...
 
bool openModelCollection (vtkPolyDataCollection *collection, QStringList &filenames)
 Opens a series of model files, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk), a Polygonal File (*.ply) or a Object file (*.obj) into a PolyData collection. More...
 
bool openModelCollection (vtkPolyDataCollection *collection)
 
bool saveModel (const QString filename, vtkPolyData *data, const bool binary=false)
 Saves a model as a file, which can be a VTK XML or Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk) or a Polygonal File (*.ply). More...
 
bool saveModel (const QString filename, milxQtModel *data, const bool binary=false)
 Saves a model as a file, which can be a VTK XML or Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk) or a Polygonal File (*.ply). More...
 
bool saveScalarsOfModel (const QString filename, milxQtModel *data)
 Saves the scalars of a model as a CSV or VTK Text file. The CSV format is output if the extension is *.csv or *.txt. More...
 
std::vector< std::string > convertQStringList (const QStringList filenames)
 Convert an QStringList to a vector of STL strings.
 
QString getPixelType ()
 
QString getComponentType ()
 
size_t getNumberOfDimensions ()
 
size_t getNumberOfComponents ()
 
void linkProgressEventOf (vtkObject *obj)
 
void updateQtEvents ()
 

Public Member Functions

 milxQtFile (QObject *theParent=0)
 The standard constructor. More...
 
virtual ~milxQtFile ()
 The standard destructor.
 
virtual const char * GetNameOfClass () const
 ITK interfacing member for exceptions.
 

Protected Attributes

QString name
 Name of the last opened file.
 
QString dataPixelType
 pixel type of image read
 
QString dataComponentType
 Component type of image read.
 
size_t dataComponents
 Components of vector of image read.
 
size_t dataDimensions
 Dimensions of image read.
 
itkEventQtObserver::Pointer observeProgress
 
vtkSmartPointer< vtkEventQtSlotConnect > Connector
 VTK Events to slots convertor.
 

Detailed Description

This class represents the MILX Qt File I/O object using VTK/ITK/Qt.

Author
Shekhar S. Chandra, 2013

The class opens and saves various data into a number of different formats via the VTK, ITK and Qt libraries transparently.

Supported Image Formats: Images (*.png *.jpeg *.jpg *.bmp *.tiff *.tif) Medical Images (*.nii *.ima *.dcm *.dicom *.mhd) with gz extensions Other Images (*.vti *.mrc *.rec)

Supported Model Formats: Model or Polygonal Files (*.vtp *.vtk *.ply *.obj). OBJ file format has read-only support.

Usage Examples: Open a model (Poly Data) file:

QPointer<milxQtFile> reader = new milxQtFile;
vtkSmartPointer<vtkPolyData> modelData;
reader->openModel(filename, modelData);

Definition at line 60 of file milxQtFile.h.

Constructor & Destructor Documentation

◆ milxQtFile()

milxQtFile::milxQtFile ( QObject *  theParent = 0)

The standard constructor.

ITK Imaging.

Connect Image Object for progress updates

Definition at line 54 of file milxQtFile.cpp.

Member Function Documentation

◆ is32BitFormat

bool milxQtFile::is32BitFormat ( const QString  filename,
bool &  errorEncountered 
)
slot

Returns if a image is an 32-bit image format or not.

Also writes Boolean into errorEncountered if error was encountered during reading of header.

Definition at line 234 of file milxQtFile.cpp.

◆ is8BitFormat

bool milxQtFile::is8BitFormat ( const QString  filename,
bool &  errorEncountered 
)
slot

Returns if a image is an 8-bit image format or not.

Also writes Boolean into errorEncountered if error was encountered during reading of header.

Definition at line 213 of file milxQtFile.cpp.

◆ isFieldFormat

bool milxQtFile::isFieldFormat ( const QString  filename,
bool &  errorEncountered 
)
slot

Returns if a image is a deformation field type image (a vector image) format or not.

Also writes Boolean into errorEncountered if error was encountered during reading of header.

Definition at line 255 of file milxQtFile.cpp.

◆ openImage [1/2]

bool milxQtFile::openImage ( const QString  filename,
vtkImageData *  data 
)
slot

Opens an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc.

You need to pre-allocate data, as the result is copied to data.

Returns true if successful. ImageData is allocated within this member, so pass a NULL pointer. Image is also flipped since the ITK reader orientation is different to VTK images.

Flip - ITK and VTK do not have the same orientation

Export to VTK and flip

Export to VTK and flip

Export to VTK and flip

Definition at line 75 of file milxQtFile.cpp.

◆ openImage [2/2]

bool milxQtFile::openImage ( const QString  filename,
milxQtImage data 
)
slot

Opens an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc. Overloaded for milxQtImage.

Returns true if successful.

Definition at line 276 of file milxQtFile.cpp.

◆ openImageSeries

bool milxQtFile::openImageSeries ( milxQtImage data,
QString  directoryPath = "" 
)
slot

Opens an DICOM series.

Returns true if successful.

If filenames list is empty ask for them

Get UIDs

Definition at line 454 of file milxQtFile.cpp.

◆ openModel [1/2]

bool milxQtFile::openModel ( const QString  filename,
vtkPolyData *  data 
)
slot

Opens a model file, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk), a Polygonal File (*.ply) or a Object file (*.obj).

You need to pre-allocate data, as the result is copied to data.

Returns true if successful. PolyData is allocated within this member, so pass a NULL pointer.

Definition at line 752 of file milxQtFile.cpp.

◆ openModel [2/2]

bool milxQtFile::openModel ( const QString  filename,
milxQtModel data 
)
slot

Opens a model file, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk), a Polygonal File (*.ply) or a Object file (*.obj).

Returns true if successful.

Definition at line 890 of file milxQtFile.cpp.

◆ openModelCollection

bool milxQtFile::openModelCollection ( vtkPolyDataCollection *  collection,
QStringList &  filenames 
)
slot

Opens a series of model files, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk), a Polygonal File (*.ply) or a Object file (*.obj) into a PolyData collection.

Filenames are asked for via a file dialog. Assumes collection is allocated but not necessarily (re)sized. It is sized accordingly internally.

Returns true if successful.

If filenames list is empty ask for them

< Remember path if successful.

Open supported model file

Definition at line 1029 of file milxQtFile.cpp.

◆ saveImage [1/2]

bool milxQtFile::saveImage ( const QString  filename,
vtkImageData *  data 
)
slot

Saves data as an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc.

Returns true if successful. ImageData is allocated within this member, so pass a NULL pointer. Image is also flipped since the ITK reader orientation is different to VTK images.

Flip - ITK and VTK do not have the same orientation

Export to ITK

Export to ITK

Export to ITK

Export to ITK

Definition at line 531 of file milxQtFile.cpp.

◆ saveImage [2/2]

bool milxQtFile::saveImage ( const QString  filename,
milxQtImage data 
)
slot

Saves data as an image file, which is any of the following: JPEG, PNG, DICOM, TIFF, NIFTI, HDR etc. Overloaded for milxQtImage.

Returns true if successful.

Definition at line 638 of file milxQtFile.cpp.

◆ saveModel [1/2]

bool milxQtFile::saveModel ( const QString  filename,
vtkPolyData *  data,
const bool  binary = false 
)
slot

Saves a model as a file, which can be a VTK XML or Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk) or a Polygonal File (*.ply).

Returns true if successful.

Definition at line 1073 of file milxQtFile.cpp.

◆ saveModel [2/2]

bool milxQtFile::saveModel ( const QString  filename,
milxQtModel data,
const bool  binary = false 
)
slot

Saves a model as a file, which can be a VTK XML or Legacy VTK PolyData File (i.e. either a *.vtp or *.vtk) or a Polygonal File (*.ply).

Returns true if successful.

Definition at line 1153 of file milxQtFile.cpp.

◆ saveScalarsOfModel

bool milxQtFile::saveScalarsOfModel ( const QString  filename,
milxQtModel data 
)
slot

Saves the scalars of a model as a CSV or VTK Text file. The CSV format is output if the extension is *.csv or *.txt.

Returns true if successful.

Definition at line 1247 of file milxQtFile.cpp.

◆ supportedImageFormats

QString milxQtFile::supportedImageFormats ( )
slot

Returns a string of supported image formats from all libraries for in file dialogs in Qt.

The string looks like "*.nii.gz *.img" etc.

Definition at line 202 of file milxQtFile.cpp.


The documentation for this class was generated from the following files: