Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::RandomParcellationGenerator< TPixel, VImageDimension > Class Template Reference

#include <mitkRandomParcellationGenerator.h>

Collaboration diagram for mitk::RandomParcellationGenerator< TPixel, VImageDimension >:

Public Types

typedef itk::Image< TPixel, VImageDimension > ImageType
 

Public Member Functions

void SetImage (itk::Image< TPixel, VImageDimension > *)
 
void SetNumberNodes (int inputNumberNodes)
 
void SetVariablesForMerging (int givenSizeOfSmallestRegion, int desiredNumberOfParcels, int givenSizeOfSmallestRegionBeginning)
 
void SetBoolsForMerging (bool mergingWithNumberParcels, bool mergingWithSmallestParcel, bool justMergeSmallParcels)
 
void GetRandomSeedVoxels ()
 Sets randomly chosen seed voxels (1x1x1 regions) on the segmented image This is done by creating a vector with unique values, which represents the position of a voxel respectively. For this purpose we count all voxels with value one and choose random numbers. More...
 
void ParcelGrowthOverFaces ()
 Add appropriate voxels of the segmented part to a region (just 6-connected neighborhood) A voxel is appropriate if the cost function value is high enough. Several constraints have to be fulfilled for this purpose. More...
 
void FillOverEdgeOrVertex ()
 Add voxels of the segmented part to an appropriate region (26-connected neighborhood) Checks which voxels still have value one and to which neighborhood-region each one should be added. More...
 
void AllocateIsolatedVoxels ()
 Add voxels of the segmented part to an appropriate region (no neighbors necessary) Checks which voxels still have value one and calculates the distance to all parcels. Finally each voxel is added to the region with the smallest distance to it. More...
 
int MergeParcels ()
 Merge parcels according to a cost function Looks for the parcel with the smallest number of voxels. Then merges it to a neighborhood-parcel such that the cost function value is small enough. The new number of nodes is returned so we can show them on the GUI. More...
 
void SetAppropriateValues ()
 Changes the values of the nodes, such that no gaps exist and it starts with value 1. More...
 
void ShowSizeOfRegions ()
 Calculates and shows the size (number of voxels) of all regions on the console. More...
 

Protected Types

typedef itk::ImageRegion< 3 > RegionType
 

Protected Member Functions

std::vector< double > GetCenterOfMass (itk::ImageRegionIterator< ImageType > it_region, int valueOfRegion, bool getSizeOfRegions)
 Gives back the center of mass and -if wanted- the size (number of voxels) of a parcel. More...
 
double GetDistance (std::vector< double > centerOfMass, typename ImageType::IndexType indexNewVoxel)
 Calculates the distance between two voxels, the position of the first one is given by an index and the position of the second one is given by a vector. More...
 
double GetDistanceVector (std::vector< double > centerOfMass, std::vector< double > indexNewVoxel)
 Calculates the distance between two voxels, both positions are given by vectors. More...
 
int SmallestValue (std::vector< int > distance)
 Gives back the smallest value of an int-vector. More...
 
double SmallestValue (std::vector< double > distance)
 Gives back the smallest value of a double-vector. More...
 
ImageType::RegionType ExtendedRegion (typename ImageType::RegionType chosenRegion, typename ImageType::IndexType indexChosenVoxel)
 Extends the region if the chosen voxel lies outside. More...
 
ImageType::RegionType ExtendedRegionNotNeighbor (typename ImageType::RegionType chosenRegion, typename ImageType::RegionType smallestRegion)
 Extends the region of a parcel such that the second region lies within. More...
 
bool IsUnique (int number, std::vector< int > vec)
 Checks if a number is an element of the vector already. More...
 
void GetSizeOfRegions ()
 Calculates the size (number of voxels) of all regions. More...
 

Protected Attributes

std::vector< std::pair< RegionType, int > > m_EvenRegions
 
std::vector< std::pair< RegionType, int > > m_OddRegions
 
std::vector< std::pair< RegionType, int > > m_InvalidRegions
 
std::vector< int > m_SizeOfRegions
 
std::vector< int > m_SizeOfFinishedRegions
 
ImageTypem_Image
 
int m_NumberNodes
 
int m_GivenSizeOfSmallestRegion
 
int m_DesiredNumberOfParcels
 
int m_GivenSizeOfSmallestRegionBeginning
 
bool m_MergingWithNumberParcels
 
bool m_MergingWithSmallestParcel
 
bool m_JustMergeSmallParcels
 

Detailed Description

template<typename TPixel, unsigned int VImageDimension>
class mitk::RandomParcellationGenerator< TPixel, VImageDimension >

Definition at line 42 of file mitkRandomParcellationGenerator.h.

Member Typedef Documentation

template<typename TPixel , unsigned int VImageDimension>
typedef itk::Image< TPixel, VImageDimension > mitk::RandomParcellationGenerator< TPixel, VImageDimension >::ImageType

Definition at line 45 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
typedef itk::ImageRegion<3> mitk::RandomParcellationGenerator< TPixel, VImageDimension >::RegionType
protected

Definition at line 105 of file mitkRandomParcellationGenerator.h.

Member Function Documentation

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::AllocateIsolatedVoxels ( )

Add voxels of the segmented part to an appropriate region (no neighbors necessary) Checks which voxels still have value one and calculates the distance to all parcels. Finally each voxel is added to the region with the smallest distance to it.

Definition at line 736 of file mitkRandomParcellationGenerator.cpp.

References MITK_DEBUG, mitk::RegionVoxelCounter< TPixel, VImageDimension >::SetImage(), mitk::RegionVoxelCounter< TPixel, VImageDimension >::SetRegion(), mitk::RegionVoxelCounter< TPixel, VImageDimension >::VoxelWithValue(), and xrand().

template<typename TPixel , unsigned int VImageDimension>
itk::Image< TPixel, VImageDimension >::RegionType mitk::RandomParcellationGenerator< TPixel, VImageDimension >::ExtendedRegion ( typename ImageType::RegionType  chosenRegion,
typename ImageType::IndexType  indexChosenVoxel 
)
protected

Extends the region if the chosen voxel lies outside.

Definition at line 244 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
itk::Image< TPixel, VImageDimension >::RegionType mitk::RandomParcellationGenerator< TPixel, VImageDimension >::ExtendedRegionNotNeighbor ( typename ImageType::RegionType  chosenRegion,
typename ImageType::RegionType  smallestRegion 
)
protected

Extends the region of a parcel such that the second region lies within.

Definition at line 277 of file mitkRandomParcellationGenerator.cpp.

References max(), and min().

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::FillOverEdgeOrVertex ( )

Add voxels of the segmented part to an appropriate region (26-connected neighborhood) Checks which voxels still have value one and to which neighborhood-region each one should be added.

Definition at line 618 of file mitkRandomParcellationGenerator.cpp.

References MITK_DEBUG, mitk::RegionVoxelCounter< TPixel, VImageDimension >::SetImage(), mitk::RegionVoxelCounter< TPixel, VImageDimension >::SetRegion(), mitk::RegionVoxelCounter< TPixel, VImageDimension >::VoxelWithValue(), and xrand().

template<typename TPixel , unsigned int VImageDimension>
std::vector< double > mitk::RandomParcellationGenerator< TPixel, VImageDimension >::GetCenterOfMass ( itk::ImageRegionIterator< ImageType it_region,
int  valueOfRegion,
bool  getSizeOfRegions 
)
protected

Gives back the center of mass and -if wanted- the size (number of voxels) of a parcel.

Definition at line 72 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
double mitk::RandomParcellationGenerator< TPixel, VImageDimension >::GetDistance ( std::vector< double >  centerOfMass,
typename ImageType::IndexType  indexNewVoxel 
)
protected

Calculates the distance between two voxels, the position of the first one is given by an index and the position of the second one is given by a vector.

Definition at line 117 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
double mitk::RandomParcellationGenerator< TPixel, VImageDimension >::GetDistanceVector ( std::vector< double >  centerOfMass,
std::vector< double >  indexNewVoxel 
)
protected

Calculates the distance between two voxels, both positions are given by vectors.

Definition at line 129 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::GetRandomSeedVoxels ( )

Sets randomly chosen seed voxels (1x1x1 regions) on the segmented image This is done by creating a vector with unique values, which represents the position of a voxel respectively. For this purpose we count all voxels with value one and choose random numbers.

Definition at line 372 of file mitkRandomParcellationGenerator.cpp.

References mitk::RegionVoxelCounter< TPixel, VImageDimension >::SetImage(), mitk::RegionVoxelCounter< TPixel, VImageDimension >::SetRegion(), mitk::RegionVoxelCounter< TPixel, VImageDimension >::VoxelWithValue(), and xrand().

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::GetSizeOfRegions ( )
protected
template<typename TPixel , unsigned int VImageDimension>
bool mitk::RandomParcellationGenerator< TPixel, VImageDimension >::IsUnique ( int  number,
std::vector< int >  vec 
)
protected

Checks if a number is an element of the vector already.

Definition at line 359 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
int mitk::RandomParcellationGenerator< TPixel, VImageDimension >::MergeParcels ( )

Merge parcels according to a cost function Looks for the parcel with the smallest number of voxels. Then merges it to a neighborhood-parcel such that the cost function value is small enough. The new number of nodes is returned so we can show them on the GUI.

Definition at line 850 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::ParcelGrowthOverFaces ( )

Add appropriate voxels of the segmented part to a region (just 6-connected neighborhood) A voxel is appropriate if the cost function value is high enough. Several constraints have to be fulfilled for this purpose.

Definition at line 446 of file mitkRandomParcellationGenerator.cpp.

References mitk::CostFunctionBase< TPixel, VImageDimension >::CalculateCost(), mitk::CostFunctionBase< TPixel, VImageDimension >::MaximalValue(), mitk::CostFunctionBase< TPixel, VImageDimension >::SetImage(), mitk::CostFunctionBase< TPixel, VImageDimension >::SetRegion(), and xrand().

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SetAppropriateValues ( )

Changes the values of the nodes, such that no gaps exist and it starts with value 1.

Definition at line 174 of file mitkRandomParcellationGenerator.cpp.

References offset.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SetBoolsForMerging ( bool  mergingWithNumberParcels,
bool  mergingWithSmallestParcel,
bool  justMergeSmallParcels 
)

Definition at line 61 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SetImage ( itk::Image< TPixel, VImageDimension > *  image)

Definition at line 41 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SetNumberNodes ( int  inputNumberNodes)

Definition at line 47 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SetVariablesForMerging ( int  givenSizeOfSmallestRegion,
int  desiredNumberOfParcels,
int  givenSizeOfSmallestRegionBeginning 
)

Definition at line 53 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
void mitk::RandomParcellationGenerator< TPixel, VImageDimension >::ShowSizeOfRegions ( )
template<typename TPixel , unsigned int VImageDimension>
int mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SmallestValue ( std::vector< int >  distance)
protected

Gives back the smallest value of an int-vector.

Definition at line 142 of file mitkRandomParcellationGenerator.cpp.

template<typename TPixel , unsigned int VImageDimension>
double mitk::RandomParcellationGenerator< TPixel, VImageDimension >::SmallestValue ( std::vector< double >  distance)
protected

Gives back the smallest value of a double-vector.

Definition at line 158 of file mitkRandomParcellationGenerator.cpp.

Member Data Documentation

template<typename TPixel , unsigned int VImageDimension>
int mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_DesiredNumberOfParcels
protected

Definition at line 117 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
std::vector<std::pair<RegionType, int> > mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_EvenRegions
protected

Definition at line 107 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
int mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_GivenSizeOfSmallestRegion
protected

Definition at line 116 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
int mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_GivenSizeOfSmallestRegionBeginning
protected

Definition at line 118 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
ImageType* mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_Image
protected

Definition at line 114 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
std::vector<std::pair<RegionType, int> > mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_InvalidRegions
protected

Definition at line 109 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
bool mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_JustMergeSmallParcels
protected

Definition at line 121 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
bool mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_MergingWithNumberParcels
protected

Definition at line 119 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
bool mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_MergingWithSmallestParcel
protected

Definition at line 120 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
int mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_NumberNodes
protected

Definition at line 115 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
std::vector<std::pair<RegionType, int> > mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_OddRegions
protected

Definition at line 108 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
std::vector<int> mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_SizeOfFinishedRegions
protected

Definition at line 112 of file mitkRandomParcellationGenerator.h.

template<typename TPixel , unsigned int VImageDimension>
std::vector<int> mitk::RandomParcellationGenerator< TPixel, VImageDimension >::m_SizeOfRegions
protected

Definition at line 110 of file mitkRandomParcellationGenerator.h.


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