![]() |
open_iA 2021.08
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
|
#include "iAToolsVTK.h"#include "iAConnector.h"#include "iAFileUtils.h"#include "iALog.h"#include "iAVtkDraw.h"#include "iAITKIO.h"#include <vtkBMPWriter.h>#include <vtkCamera.h>#include <vtkImageCast.h>#include <vtkImageData.h>#include <vtkImageWriter.h>#include <vtkJPEGWriter.h>#include <vtkObjectFactory.h>#include <vtkPNGWriter.h>#include <vtkTIFFWriter.h>#include <vtkSmartVolumeMapper.h>#include <QFileInfo>#include <QRegularExpression>#include <QStringList>Functions | |
| void | addImages (vtkSmartPointer< vtkImageData > imgDst, vtkSmartPointer< vtkImageData > const imgToAdd) |
| add values of one image to the values of another image More... | |
| vtkSmartPointer< vtkImageData > | allocateImage (int vtkType, int const dimensions[3], double const spacing[3]) |
| Create a VTK image with the given properties. More... | |
| vtkSmartPointer< vtkImageData > | allocateImage (int vtkType, int const dimensions[3], double const spacing[3], int numComponents) |
| Create a VTK image with the given properties. More... | |
| vtkSmartPointer< vtkImageData > | allocateImage (vtkSmartPointer< vtkImageData > img) |
| Create a VTK image that has the same properties (type, size, spacing) as the given image. More... | |
| void | fillImage (vtkSmartPointer< vtkImageData > img, double const value) |
| fill all pixels in the given image with the given value More... | |
| bool | isVtkIntegerImage (vtkImageData *img) |
| Check whether the given image holds integer numbers. More... | |
| int | mapReadableDataTypeToVTKType (QString const &dataTypeName) |
| Maps a given data type string to the corresponding VTK type identifier. More... | |
| int | mapRenderModeToEnum (QString const &modeName) |
| QString | mapVTKTypeToReadableDataType (int vtkType) |
| Maps a given VTK type to the corresponding readable data type. More... | |
| size_t | mapVTKTypeToSize (int vtkType) |
| Returns the size (in bytes) of the given VTK type. More... | |
| iAbase_API void | multiplyImage (vtkSmartPointer< vtkImageData > imgDst, double value) |
| multiply all values of an image with the given value More... | |
| QStringList const & | readableDataTypeList (bool withLongLongTypes) |
| Returns a human-readable list of available data types for a single pixel/voxel. More... | |
| void | readImage (QString const &filename, bool releaseFlag, vtkSmartPointer< vtkImageData > &ptr) |
| Read an image from disk into a VTK image. More... | |
| QMap< int, QString > const & | RenderModeMap () |
| void | setCamPosition (vtkCamera *cam, iACameraPosition pos) |
| void | storeImage (vtkSmartPointer< vtkImageData > img, QString const &filename, bool useCompression) |
| Stores an image on disk (typically in .mhd format). More... | |
| vtkStandardNewMacro (iAvtkImageData) | |
| void | writeSingleSliceImage (QString const &filename, vtkImageData *img) |
| Write a single slice image to a common 2D picture format. More... | |
| void addImages | ( | vtkSmartPointer< vtkImageData > | imgDst, |
| vtkSmartPointer< vtkImageData > const | imgToAdd | ||
| ) |
add values of one image to the values of another image
| imgDst | destination image (will be modified) |
| imgToAdd | image with values to be added to imgDst (will not be modified) |
| vtkSmartPointer< vtkImageData > allocateImage | ( | int | vtkType, |
| int const | dimensions[3], | ||
| double const | spacing[3] | ||
| ) |
Create a VTK image with the given properties.
| vtkType | the VTK type identifier (VTK_INT, VTK_UNSIGNED_CHAR, ...) for the voxel data type to use in the new image |
| dimensions | the size of the image in the 3 dimensions. |
| spacing | the spacing (distance of voxels) in each of the 3 dimension directions. |
| vtkSmartPointer< vtkImageData > allocateImage | ( | int | vtkType, |
| int const | dimensions[3], | ||
| double const | spacing[3], | ||
| int | numComponents | ||
| ) |
Create a VTK image with the given properties.
| vtkType | the VTK type identifier (VTK_INT, VTK_UNSIGNED_CHAR, ...) for the voxel data type to use in the new image |
| dimensions | the size of the image in the 3 dimensions. |
| spacing | the spacing (distance of voxels) in each of the 3 dimension directions. |
| numComponents | the number of components in each voxel. |
| vtkSmartPointer< vtkImageData > allocateImage | ( | vtkSmartPointer< vtkImageData > | img | ) |
Create a VTK image that has the same properties (type, size, spacing) as the given image.
| img | image whose type, size and spacing will be used to create the result image; its data will not be copied over to the new image |
| void fillImage | ( | vtkSmartPointer< vtkImageData > | img, |
| double const | value | ||
| ) |
fill all pixels in the given image with the given value
| img | image to be filled |
| value | used to fill each voxel in given image |
| bool isVtkIntegerImage | ( | vtkImageData * | img | ) |
Check whether the given image holds integer numbers.
| img | a VTK image |
| int mapReadableDataTypeToVTKType | ( | QString const & | dataTypeName | ) |
Maps a given data type string to the corresponding VTK type identifier.
| dataTypeName | an entry from the list of readable data types (see readableDataTypeList()) |
| int mapRenderModeToEnum | ( | QString const & | modeName | ) |
| QString mapVTKTypeToReadableDataType | ( | int | vtkType | ) |
Maps a given VTK type to the corresponding readable data type.
| vtkType | the VTK type identifier (VTK_INT, VTK_UNSIGNED_CHAR, ...) |
| size_t mapVTKTypeToSize | ( | int | vtkType | ) |
Returns the size (in bytes) of the given VTK type.
| vtkType | a VTK type identifier (VTK_INT, VTK_UNSIGNED_CHAR, ...) |
| iAbase_API void multiplyImage | ( | vtkSmartPointer< vtkImageData > | imgDst, |
| double | value | ||
| ) |
multiply all values of an image with the given value
| imgDst | the image to be multiplied |
| value | multiplier used for each voxel |
| QStringList const & readableDataTypeList | ( | bool | withLongLongTypes | ) |
Returns a human-readable list of available data types for a single pixel/voxel.
| withLongLongTypes |
| void readImage | ( | QString const & | filename, |
| bool | releaseFlag, | ||
| vtkSmartPointer< vtkImageData > & | ptr | ||
| ) |
Read an image from disk into a VTK image.
| filename | the name of the file to read. |
| releaseFlag | whether the ITK release flag should be set on the ITK image reader |
| ptr | the smart pointer in which to store the loaded image (it will be assigned a new vtkImageData) |
| QMap< int, QString > const & RenderModeMap | ( | ) |
| void setCamPosition | ( | vtkCamera * | cam, |
| iACameraPosition | pos | ||
| ) |
| void storeImage | ( | vtkSmartPointer< vtkImageData > | img, |
| QString const & | filename, | ||
| bool | useCompression = true |
||
| ) |
Stores an image on disk (typically in .mhd format).
| img | the image to store |
| filename | the name of the file to write to. |
| useCompression | whether the file should be compressed (.zraw) or not (.raw) in case we are storing .mhd files |
| vtkStandardNewMacro | ( | iAvtkImageData | ) |
| void writeSingleSliceImage | ( | QString const & | filename, |
| vtkImageData * | img | ||
| ) |
Write a single slice image to a common 2D picture format.
| filename | the name of the file to write to; this is expected to have an extension of tif, png, jpg or bmp; the type of the file written will be chosen according to this extension |
| img | the image to write; this already needs to be a 2D image (i.e., size in Z dimension = 1) |