17 #ifndef mitkRandomParcellationGenerator_h
18 #define mitkRandomParcellationGenerator_h
23 #include "MitkConnectomicsExports.h"
30 #include <itkNeighborhoodIterator.h>
31 #include <itkImageRegionIterator.h>
41 template <
typename TPixel,
unsigned int VImageDimension>
45 typedef itk::Image< TPixel, VImageDimension >
ImageType;
48 void SetImage(itk::Image<TPixel, VImageDimension> *);
50 void SetVariablesForMerging(
int givenSizeOfSmallestRegion,
int desiredNumberOfParcels,
int givenSizeOfSmallestRegionBeginning);
51 void SetBoolsForMerging(
bool mergingWithNumberParcels,
bool mergingWithSmallestParcel,
bool justMergeSmallParcels);
87 std::vector<double>
GetCenterOfMass( itk::ImageRegionIterator<ImageType> it_region,
int valueOfRegion,
bool getSizeOfRegions );
89 double GetDistance( std::vector<double> centerOfMass,
typename ImageType::IndexType indexNewVoxel);
91 double GetDistanceVector( std::vector<double> centerOfMass, std::vector<double> indexNewVoxel);
97 typename ImageType::RegionType
ExtendedRegion(
typename ImageType::RegionType chosenRegion,
typename ImageType::IndexType indexChosenVoxel);
99 typename ImageType::RegionType
ExtendedRegionNotNeighbor(
typename ImageType::RegionType chosenRegion,
typename ImageType::RegionType smallestRegion);
101 bool IsUnique (
int number, std::vector<int> vec);
bool m_JustMergeSmallParcels
int m_GivenSizeOfSmallestRegion
int MergeParcels()
Merge parcels according to a cost function Looks for the parcel with the smallest number of voxels...
std::vector< int > m_SizeOfRegions
bool IsUnique(int number, std::vector< int > vec)
Checks if a number is an element of the vector already.
itk::ImageRegion< 3 > RegionType
DataCollection - Class to facilitate loading/accessing structured data.
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 th...
bool m_MergingWithSmallestParcel
int m_GivenSizeOfSmallestRegionBeginning
std::vector< std::pair< RegionType, int > > m_EvenRegions
void SetImage(itk::Image< TPixel, VImageDimension > *)
void ShowSizeOfRegions()
Calculates and shows the size (number of voxels) of all regions on the console.
void SetBoolsForMerging(bool mergingWithNumberParcels, bool mergingWithSmallestParcel, bool justMergeSmallParcels)
itk::Image< TPixel, VImageDimension > ImageType
void SetVariablesForMerging(int givenSizeOfSmallestRegion, int desiredNumberOfParcels, int givenSizeOfSmallestRegionBeginning)
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.
void GetSizeOfRegions()
Calculates the size (number of voxels) of all regions.
void SetAppropriateValues()
Changes the values of the nodes, such that no gaps exist and it starts with value 1...
int SmallestValue(std::vector< int > distance)
Gives back the smallest value of an int-vector.
ImageType::RegionType ExtendedRegion(typename ImageType::RegionType chosenRegion, typename ImageType::IndexType indexChosenVoxel)
Extends the region if the chosen voxel lies outside.
std::vector< int > m_SizeOfFinishedRegions
void GetRandomSeedVoxels()
Sets randomly chosen seed voxels (1x1x1 regions) on the segmented image This is done by creating a ve...
double GetDistanceVector(std::vector< double > centerOfMass, std::vector< double > indexNewVoxel)
Calculates the distance between two voxels, both positions are given by vectors.
void AllocateIsolatedVoxels()
Add voxels of the segmented part to an appropriate region (no neighbors necessary) Checks which voxel...
ImageType::RegionType ExtendedRegionNotNeighbor(typename ImageType::RegionType chosenRegion, typename ImageType::RegionType smallestRegion)
Extends the region of a parcel such that the second region lies within.
void SetNumberNodes(int inputNumberNodes)
void FillOverEdgeOrVertex()
Add voxels of the segmented part to an appropriate region (26-connected neighborhood) Checks which vo...
bool m_MergingWithNumberParcels
std::vector< std::pair< RegionType, int > > m_OddRegions
std::vector< std::pair< RegionType, int > > m_InvalidRegions
int m_DesiredNumberOfParcels
void ParcelGrowthOverFaces()
Add appropriate voxels of the segmented part to a region (just 6-connected neighborhood) A voxel is a...