#include <mitkVolume.h>
Inherits mitkDataObject.
Inherited by mitkICVolume, and mitkOoCVolume.
Inheritance diagram for mitkVolume:
Public Member Functions | |
virtual void | PrintSelf (ostream &os) |
virtual void | Initialize () |
virtual int | GetDataObjectType () const |
void | SetDimensions (int dims[3]) |
void | GetDimensions (int dims[3]) const |
void | SetWidth (int w) |
int | GetWidth () const |
void | SetHeight (int h) |
int | GetHeight () const |
void | SetSliceNum (int s) |
void | SetImageNum (int s) |
int | GetSliceNum () const |
int | GetImageNum () const |
int | GetDimensionality () const |
void | SetSpacings (float s[3]) |
void | GetSpacings (float s[3]) const |
void | SetSpacingX (float px) |
float | GetSpacingX () const |
void | SetSpacingY (float py) |
float | GetSpacingY () const |
void | SetSpacingZ (float pz) |
float | GetSpacingZ () const |
void | SetChannelNum (int n) |
void | SetNumberOfChannel (int n) |
int | GetChannelNum () const |
int | GetNumberOfChannel () const |
void | GetIncrements (int incs[3]) const |
int | GetIncrementX () const |
int | GetIncrementY () const |
int | GetIncrementZ () const |
double | GetData (int x, int y, int z, int c=0) |
void | GetPointGradient (int i, int j, int k, float g[3]) |
double | GetDataTypeMin () const |
double | GetDataTypeMax () const |
void | SetWindowWidth (float wWidth) |
void | SetWindowCenter (float wCenter) |
float | GetWindowWidth () |
float | GetWindowCenter () |
void | GetWidthCenter (float &wWidth, float &wCenter) |
bool | HasWidthCenter () const |
int | GetDataTypeSize () const |
void | SetDataType (int data_type) |
int | GetDataType () const |
void | SetDataTypeToFloat () |
void | SetDataTypeToDouble () |
void | SetDataTypeToInt () |
void | SetDataTypeToUnsignedInt () |
void | SetDataTypeToLong () |
void | SetDataTypeToUnsignedLong () |
void | SetDataTypeToShort () |
void | SetDataTypeToUnsignedShort () |
void | SetDataTypeToUnsignedChar () |
void | SetDataTypeToChar () |
void | GetMinMaxValue (int sliceIdx, double &minValue, double &maxValue, bool needRecalculate=false) |
void | GetMinMaxValue (double &minValue, double &maxValue, bool needRecalculate=false) |
virtual void | ShallowCopy (mitkDataObject *src) |
virtual void | DeepCopy (mitkDataObject *src) |
virtual void | FreezeSlice (int sliceIdx) |
virtual void | UnFreezeSlice (int sliceIdx) |
virtual void const * | GetData () const =0 |
virtual void * | GetData ()=0 |
void * | GetSliceData (int sliceIdx) |
virtual void const * | GetSliceForRead (int sliceIdx)=0 |
virtual void * | GetSliceForWrite (int sliceIdx)=0 |
virtual void * | GetSliceForReadWrite (int sliceIdx)=0 |
virtual bool | ReadSliceData (int sliceIdx, void *dst)=0 |
virtual bool | ReadYZSliceData (int xIdx, void *dst)=0 |
virtual bool | ReadXZSliceData (int yIdx, void *dst)=0 |
virtual bool | GetArbitrarySlice (int w, int h, double o[3], double ux[3], double uy[3], void *dst)=0 |
virtual bool | WriteSliceData (int sliceIdx, void const *src)=0 |
virtual bool | ReadSubVolume (int x, int y, int z, int w, int h, int d, int &tw, int &th, int &td, void *dst)=0 |
virtual bool | WriteSubVolume (int x, int y, int z, int w, int h, int d, int &tw, int &th, int &td, void const *src)=0 |
virtual bool | Allocate ()=0 |
mitkVolume is a very important class in MITK. And most algorithms may use it as input or output. In concept, it is a multi-dimensional dataset. You can access the property and actual data of this dataset through the interface provided by mitkVolume. mitkVolume supports 1D, 2D and 3D dataset, various data type, multi-channel image, and out-of-core data loading. Two examples using mitkVolume are given below.
Example 1: If you want to create a new volume and fill its data, for example, read a file into volume, the code snippet is:
// mitkVolume is an abstract class, so you should new mitkICVolume // (for in-core data) or mitkOoCVolume (for out-of-core data) for actual // use. mitkVolume *aVolume = new mitkICVolume; // or mitkOoCVolume aVolume->SetWidth(sliceWidth); aVolume->SetHeight(sliceHeight); aVolume->SetSliceNum(sliceNum); aVolume->SetSpacingX(sliceSpacingX); aVolume->SetSpacingY(sliceSpacingY); aVolume->SetSpacingZ(sliceSpacingZ); aVolume->SetChannelNum(sliceChannelNum); aVolume->SetDataType(sliceDataType); // volume has got enough information, now allocate memory if (aVolume->Allocate()) { Read the content of disk file to aVolume via WriteSliceData(); Use aVolume ...; }
sliceWidth = aVolume->GetWidth(); sliceHeight = aVolume->GetHeight(); sliceNum = aVolume->GetSliceNum(); sliceSpacingX = aVolume->GetSpacingX(); sliceSpacingY = aVolume->GetSpacingY(); sliceSpacingZ = aVolume->GetSpacingZ(); sliceChannelNum = aVolume->GetChannelNum(); sliceDataType = aVolume->GetDataType(); for(int i = 0; i < imageNum; i++) //Access every slice data { sliceData = aVolume->GetSliceData(i); // or using ReadSliceData() to copy data to a user specified buffer Process sliceData according to sliceDataType; }
|
Allocate necessary space for holding the image data. It calculate the memory size using current Dimensions, DataType and NumberOfChannel settings. The equation is shown as follow:
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Implements mitkDataObject. Reimplemented in mitkICVolume, and mitkOoCVolume. |
|
Lock the physical memory containing sliceIdx'th slice data. (only useful for out-of-core volume data (mitkOoCVolume) to avoid swapping some slice data from memory buffer to disk buffer, i.e. to keep the returned pointer of some 'Get' functions, such as GetSliceData(), GetSliceForRead() and so on, always be valid until call UnFreezeSlice().
Reimplemented in mitkOoCVolume. |
|
Get arbitrary directional slice from the volume to a specified memory buffer (i.e. re-slicing).
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Get the channel number of this volume.
|
|
Get data pointer of the volume data (changeable).
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Get data pointer of the volume data (unchangeable).
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Get value of a specified voxel's channel.
|
|
Return the data object type.
Reimplemented from mitkDataObject. Reimplemented in mitkICVolume, and mitkOoCVolume. |
|
Get data type of this volume. MITK supports various data type.
|
|
Get the maximum value of the data type of this volume.
|
|
Get the minimum value of the data type of this volume.
|
|
Get the size of the data type in bytes.
|
|
Get the dimension of this volume. return 2 --- 2D image |
|
Get dimension in x, y, z direction of this volume.
|
|
Get the height of this volume (dimension in y).
|
|
Provided for convenience, just the same as GetSliceNum(). |
|
Get the increments in x, y and z directions.
|
|
Get the increment in x direction.
|
|
Get the increment in y direction.
|
|
Get the increment in z direction.
|
|
Get the minimum and maximum data value of all the volume data.
|
|
Get the minimum and maximum data value in a specified slice.
|
|
Just the same as GetChannelNum(). |
|
Useless. Obsolete. |
|
Provided for back compatibility, just the same as GetSliceForReadWrite(). |
|
Get data pointer of a specified slice in the volume (for read only).
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Get data pointer of a specified slice in the volume (for read & write).
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Get data pointer of a specified slice in the volume (for write only).
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Get the slice/image number of this volume (dimension in z).
|
|
Get spacing information in x, y and z axis, the unit is mm.
|
|
Get spacing information in x axis, the unit is mm.
|
|
Get spacing information in y axis, the unit is mm.
|
|
Get spacing information in z axis, the unit is mm.
|
|
Get the width of this volume (dimension in x).
|
|
Get the window width and center for display in mitkImageScene.
|
|
Get the window center for display in mitkImageScene.
|
|
Get the window width for display in mitkImageScene.
|
|
Get the flag which indicates whether this volume has window width and center
|
|
Delete the allocated memory (if any) and initialize to default status. Implements mitkDataObject. Reimplemented in mitkICVolume, and mitkOoCVolume. |
|
Print the necessary information about this object for the debugging purpose.
Reimplemented from mitkDataObject. Reimplemented in mitkICVolume, and mitkOoCVolume. |
|
Copy slice data from the volume to a specified memory buffer.
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Copy a sub-volume (start position = (x, y, z), size = w * h * d) from the volume to a specified memory buffer.
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Copy y-directional slice from the volume to a specified memory buffer.
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Copy x-directional slice from the volume to a specified memory buffer.
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Set the channel number of this volume.
|
|
Set data type of this volume. MITK supports various data type.
|
|
Set data type of this volume to char. |
|
Set data type of this volume to double. |
|
Set data type of this volume to float. |
|
Set data type of this volume to int. |
|
Set data type of this volume to long. |
|
Set data type of this volume to short. |
|
Set data type of this volume to unsigned char. |
|
Set data type of this volume to unsigned int. |
|
Set data type of this volume to unsigned long. |
|
Set data type of this volume to unsigned short. |
|
Set dimension in x, y, z direction of this volume.
|
|
Set the height of this volume (dimension in y).
|
|
Provided for convenience, just the same as SetSliceNum(). |
|
Just the same as SetChannelNum(). |
|
Set the slice/image number of this volume (dimension in z).
|
|
Set spacing information in x, y and z axis, the unit is mm.
|
|
Set spacing information in x axis, the unit is mm.
|
|
Set spacing information in y axis, the unit is mm.
|
|
Set spacing information in z axis, the unit is mm.
|
|
Set the width of this volume (dimension in x).
|
|
Set the window center for display in mitkImageScene.
|
|
Set the window width for display in mitkImageScene.
|
|
Implements mitkDataObject. Reimplemented in mitkICVolume, and mitkOoCVolume. |
|
Unlock the physical memory containing sliceIdx'th slice data.
Reimplemented in mitkOoCVolume. |
|
Copy slice data from a specified memory buffer to the volume.
Implemented in mitkICVolume, and mitkOoCVolume. |
|
Copy a sub-volume (start position = (x, y, z), size = w * h * d) from a specified memory buffer to the volume.
Implemented in mitkICVolume, and mitkOoCVolume. |