15 #ifndef niftkGeneralSegmentorUtils_h
16 #define niftkGeneralSegmentorUtils_h
18 #include "niftkMIDASExports.h"
21 #include <itkPolyLineParametricPath.h>
23 #include <mitkContourModelSet.h>
24 #include <mitkDataNode.h>
25 #include <mitkImage.h>
26 #include <mitkPointSet.h>
42 int projectedSliceNumber,
43 mitk::ContourModelSet* outputContourSet
48 template<
typename TPixel,
unsigned int VImageDimension>
50 itk::Image<TPixel, VImageDimension>* itkImage,
57 template<
typename TPixel,
unsigned int VImageDimension>
59 itk::Image<TPixel, VImageDimension>* itkImage
64 template<
typename TPixel,
unsigned int VImageDimension>
66 const itk::Image<TPixel, VImageDimension>*
input,
67 itk::Image<TPixel, VImageDimension>* output
72 template<
typename TPixel,
unsigned int VImageDimension>
74 const itk::Image<TPixel, VImageDimension>*
input,
77 itk::Image<TPixel, VImageDimension>* output
81 template<
typename TPixel,
unsigned int VImageDimension>
83 const itk::Image<TPixel, VImageDimension>* itkImage,
90 template<
typename TPixel,
unsigned int VImageDimension>
92 const itk::Image<TPixel, VImageDimension>* itkImage,
95 std::vector<int>& outputRegion
100 template<
typename TPixel,
unsigned int VImageDimension>
101 void ITKClearSlice(itk::Image<TPixel, VImageDimension>* itkImage,
108 template<
typename TPixel,
unsigned int VImageDimension>
110 const itk::Image<TPixel, VImageDimension>* itkImage,
111 const mitk::PointSet* inputSeeds,
114 mitk::PointSet* outputSeeds
120 template<
typename TPixel,
unsigned int VImageDimension>
122 const itk::Image<TPixel, VImageDimension>* itkImage,
123 const mitk::PointSet* inputSeeds,
133 template<
typename TPixel,
unsigned int VImageDimension>
135 const itk::Image<TPixel, VImageDimension>* itkImage,
137 const mitk::PointSet* inputSeeds,
138 mitk::PointSet* outputCopyOfInputSeeds,
139 mitk::PointSet* outputNewSeedsNotInRegionOfInterest
143 template<
typename TPixel,
unsigned int VImageDimension>
145 const itk::Image<TPixel, VImageDimension>* itkImage,
146 const mitk::PointSet* seeds,
153 template<
typename TPixel,
unsigned int VImageDimension>
155 const itk::Image<TPixel, VImageDimension>* itkImage,
158 bool& outputSliceIsEmpty
166 template<
typename TPixel,
unsigned int VImageDimension>
168 const itk::Image<TPixel, VImageDimension>* itkImage,
170 const mitk::Image* workingImage,
171 const mitk::PointSet* seeds,
172 mitk::ContourModelSet* segmentationContours,
173 mitk::ContourModelSet* drawContours,
174 mitk::ContourModelSet* polyContours,
177 double lowerThreshold,
178 double upperThreshold,
179 mitk::Image* outputRegionGrowingImage
184 template<
typename TPixel,
unsigned int VImageDimension>
186 const itk::Image<TPixel, VImageDimension>* itkImage,
187 const mitk::PointSet* inputSeeds,
191 double lowerThreshold,
192 double upperThreshold,
193 mitk::PointSet* outputCopyOfInputSeeds,
194 mitk::PointSet* outputNewSeeds,
195 std::vector<int>& outputRegion,
196 mitk::Image* outputRegionGrowingImage
204 template<
typename TPixel,
unsigned int VImageDimension>
206 const itk::Image<TPixel, VImageDimension>* itkImage,
207 const mitk::PointSet* seeds,
211 double lowerThreshold,
212 double upperThreshold,
213 mitk::Image* outputRegionGrowingImage
218 template <
typename TGreyScalePixel,
unsigned int VImageDimension>
220 const itk::Image<TGreyScalePixel, VImageDimension>* itkImage,
221 mitk::Image* segmentedImage,
222 mitk::Image* regionGrowingImage,
227 template<
typename TPixel,
unsigned int VImageDimension>
229 const itk::Image<TPixel, VImageDimension>* itkImage,
232 int projectedSliceIndex,
233 mitk::ContourModelSet* contourSet
240 template<
typename TPixel,
unsigned int VImageDimension>
242 const itk::Image<TPixel, VImageDimension>* itkImage,
243 TPixel foregroundPixelValue,
250 template<
typename TPixel,
unsigned int VImageDimension>
252 const itk::Image<TPixel, VImageDimension>* itkImage,
255 mitk::PointSet* outputNewSeeds
269 template<
typename TPixel,
unsigned int VImageDimension>
271 const itk::Image<TPixel, VImageDimension>* itkImage,
272 const mitk::PointSet* inputSeeds,
277 bool optimiseSeedPosition,
278 bool newSliceIsEmpty,
279 mitk::PointSet* outputCopyOfInputSeeds,
280 mitk::PointSet* outputNewSeeds,
281 std::vector<int>& outputRegion
286 template<
typename TPixel,
unsigned int VImageDimension>
288 const itk::Image<TPixel, VImageDimension>* itkImage,
289 const mitk::PointSet* inputSeeds,
293 mitk::PointSet* outputCopyOfInputSeeds,
294 mitk::PointSet* outputNewSeeds,
295 std::vector<int>& outputRegion
304 template<
typename TPixel,
unsigned int VImageDimension>
306 itk::Image<TPixel, VImageDimension>* itkImage,
307 mitk::PointSet* currentSeeds,
312 template<
typename TPixel,
unsigned int VImageDimension>
314 const itk::Image<TPixel, VImageDimension>* itkImage
327 template<
typename TPixel,
unsigned int VImageDimension>
329 const itk::Image<TPixel, VImageDimension>* itkImage,
330 const mitk::PointSet* seeds,
331 mitk::ContourModelSet* segmentationContours,
332 mitk::ContourModelSet* polyToolContours,
333 mitk::ContourModelSet* drawToolContours,
334 const mitk::Image* workingImage,
335 double lowerThreshold,
336 double upperThreshold,
340 bool& sliceDoesHaveUnenclosedSeeds
354 template<
typename TPixel,
unsigned int VImageDimension>
356 const itk::Image<TPixel, VImageDimension>* itkImage,
357 const mitk::Image* workingImage,
358 const mitk::PointSet* seeds,
359 mitk::ContourModelSet* segmentationContours,
360 mitk::ContourModelSet* drawContours,
361 mitk::ContourModelSet* polyContours,
364 double lowerThreshold,
365 double upperThreshold,
367 mitk::ContourModelSet* outputCopyOfInputContours,
368 mitk::ContourModelSet* outputContours
376 template<
typename TPixel,
unsigned int VImageDimension>
378 const itk::Image<TPixel, VImageDimension>* itkImage,
379 const mitk::PointSet* currentSeeds,
380 mitk::PointSet* newSeeds,
389 template<
typename TPixel,
unsigned int VImageDimension>
391 const itk::Image<TPixel, VImageDimension>* itkImage
401 template<
typename TPixel,
unsigned int VImageDimension>
403 const itk::Image<TPixel, VImageDimension>* itkImage,
404 mitk::PointSet* seeds,
411 #include "niftkGeneralSegmentorUtils.txx"
void ITKClearImage(itk::Image< TPixel, VImageDimension > *itkImage)
Clears an image by setting all voxels to zero using ITKFillRegion.
void ITKPreprocessingOfSeedsForChangingSlice(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *inputSeeds, int oldSliceAxis, int oldSliceIndex, int newSliceAxis, int newSliceIndex, bool optimiseSeedPosition, bool newSliceIsEmpty, mitk::PointSet *outputCopyOfInputSeeds, mitk::PointSet *outputNewSeeds, std::vector< int > &outputRegion)
Does any pre-processing of seeds necessary to facilitate Undo/Redo for Threshold Apply, and also changing slice.
void ITKFilterSeedsToCurrentSlice(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *inputSeeds, int sliceAxis, int sliceIndex, mitk::PointSet *outputSeeds)
Takes the inputSeeds and filters them so that outputSeeds contains just those seeds contained within ...
void ITKSliceDoesHaveUnenclosedSeeds(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *seeds, mitk::ContourModelSet *segmentationContours, mitk::ContourModelSet *polyToolContours, mitk::ContourModelSet *drawToolContours, const mitk::Image *workingImage, double lowerThreshold, double upperThreshold, bool useThresholds, int sliceAxis, int sliceIndex, bool &sliceDoesHaveUnenclosedSeeds)
Will return true if slice has unenclosed seeds, and false otherwise.
bool ITKSliceIsEmpty(const itk::Image< TPixel, VImageDimension > *itkImage, int sliceAxis, int sliceIndex, bool &outputSliceIsEmpty)
Creates a region of interest within itkImage corresponding to the given slice, and checks if it is em...
void ITKGetLargestMinimumDistanceSeedLocation(const itk::Image< TPixel, VImageDimension > *itkImage, TPixel foregroundPixelValue, typename itk::Image< TPixel, VImageDimension >::IndexType &outputSeedIndex, int &outputDistance)
Works out the largest minimum distance to the edge of the image data, filtered on a given foregroundP...
void ITKCalculateSliceRegionAsVector(const itk::Image< TPixel, VImageDimension > *itkImage, int sliceAxis, int sliceIndex, std::vector< int > &outputRegion)
Calculates the region corresponding to a single slice.
GLenum GLenum GLenum input
Definition: glew.h:12016
void ITKPropagateToRegionGrowingImage(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *inputSeeds, int sliceAxis, int sliceIndex, int direction, double lowerThreshold, double upperThreshold, mitk::PointSet *outputCopyOfInputSeeds, mitk::PointSet *outputNewSeeds, std::vector< int > &outputRegion, mitk::Image *outputRegionGrowingImage)
Method takes all the input, and calculates the 3D propagated region (up or down or 3D)...
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
void ITKRecalculateMinAndMaxOfSeedValues(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *inputSeeds, int sliceAxis, int sliceIndex, double &min, double &max)
Called from RecalculateMinAndMaxOfSeedValues(), the actual method in ITK that recalculates the min an...
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
void GenerateOutlineFromBinaryImage(mitk::Image::Pointer image, int sliceAxis, int sliceIndex, int projectedSliceIndex, mitk::ContourModelSet *outputContourSet)
Used to generate a contour outline round a binary segmentation image, and refreshes the outputSurface...
Definition: niftkGeneralSegmentorUtils.cxx:23
void ITKCopyRegion(const itk::Image< TPixel, VImageDimension > *input, int sliceAxis, int sliceIndex, itk::Image< TPixel, VImageDimension > *output)
Copies the region from input to output, assuming both images are the same size, and contain the regio...
void ITKPreprocessingForWipe(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *inputSeeds, int sliceAxis, int sliceIndex, int direction, mitk::PointSet *outputCopyOfInputSeeds, mitk::PointSet *outputNewSeeds, std::vector< int > &outputRegion)
Does any pre-processing necessary to facilitate Undo/Redo for Wipe commands, which in this case means...
void ITKFilterInputPointSetToExcludeRegionOfInterest(const itk::Image< TPixel, VImageDimension > *itkImage, const typename itk::Image< TPixel, VImageDimension >::RegionType ®ionOfInterest, const mitk::PointSet *inputSeeds, mitk::PointSet *outputCopyOfInputSeeds, mitk::PointSet *outputNewSeedsNotInRegionOfInterest)
Takes the inputSeeds and copies them to outputCopyOfInputSeeds, and also copies seeds to outputNewSee...
void ITKAddNewSeedsToPointSet(const itk::Image< TPixel, VImageDimension > *itkImage, const typename itk::Image< TPixel, VImageDimension >::RegionType ®ionOfInterest, int sliceAxis, mitk::PointSet *outputNewSeeds)
For the given input itkImage (assumed to always be binary), and regionOfInterest, will iterate on a s...
void ITKGenerateOutlineFromBinaryImage(const itk::Image< TPixel, VImageDimension > *itkImage, int sliceAxis, int sliceIndex, int projectedSliceIndex, mitk::ContourModelSet *contourSet)
Called to extract a contour set from a binary image, as might be used for "See Prior", "See Next", or the outlining a binary segmentation.
bool ITKSliceDoesHaveSeeds(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *seeds, int sliceAxis, int sliceIndex)
Will return true if the given slice has seeds within that slice.
void ITKFilterContours(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::Image *workingImage, const mitk::PointSet *seeds, mitk::ContourModelSet *segmentationContours, mitk::ContourModelSet *drawContours, mitk::ContourModelSet *polyContours, int sliceAxis, int sliceIndex, double lowerThreshold, double upperThreshold, bool isThresholding, mitk::ContourModelSet *outputCopyOfInputContours, mitk::ContourModelSet *outputContours)
Extracts a new contour set, for doing "Clean" operation.
void ITKFillRegion(itk::Image< TPixel, VImageDimension > *itkImage, const typename itk::Image< TPixel, VImageDimension >::RegionType ®ion, TPixel fillValue)
Fills the itkImage region with the fillValue.
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
bool ITKImageHasNonZeroEdgePixels(const itk::Image< TPixel, VImageDimension > *itkImage)
Returns true if the image has non-zero edge pixels, and false otherwise.
void ITKPropagateToSegmentationImage(const itk::Image< TGreyScalePixel, VImageDimension > *itkImage, mitk::Image *segmentedImage, mitk::Image *regionGrowingImage, OpPropagate *op)
Called from the ExecuteOperate (i.e. undo/redo framework) to actually apply the calculated propagated...
void ITKDestroyPipeline(const itk::Image< TPixel, VImageDimension > *itkImage)
Completely removes the current 2D region growing pipeline that is stored in the map m_TypeToPipelineM...
void ITKClearSlice(itk::Image< TPixel, VImageDimension > *itkImage, int sliceAxis, int sliceIndex)
Clears a slice by setting all voxels to zero for a given slice and axis.
void ITKInitialiseSeedsForSlice(const itk::Image< TPixel, VImageDimension > *itkImage, mitk::PointSet *seeds, int sliceAxis, int sliceIndex)
Creates seeds for each distinct 4-connected region for a given slice.
void ITKCalculateSliceRegion(const itk::Image< TPixel, VImageDimension > *itkImage, int sliceAxis, int sliceIndex, typename itk::Image< TPixel, VImageDimension >::RegionType &outputRegion)
Calculates the region corresponding to a single slice.
void ITKPropagateUpOrDown(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *seeds, int sliceAxis, int sliceIndex, int direction, double lowerThreshold, double upperThreshold, mitk::Image *outputRegionGrowingImage)
Called from ITKPropagateToRegionGrowingImage to propagate up or down.
void ITKPropagateSeedsToNewSlice(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::PointSet *currentSeeds, mitk::PointSet *newSeeds, int sliceAxis, int oldSliceIndex, int newSliceIndex)
Given an image, and a set of seeds, will append new seeds in the new slice if necessary.
Definition: niftkExceptionObject.h:21
void ITKDoWipe(itk::Image< TPixel, VImageDimension > *itkImage, mitk::PointSet *currentSeeds, OpWipe *op)
Does the wipe command for Wipe, Wipe+, Wipe-.
void ITKCopyImage(const itk::Image< TPixel, VImageDimension > *input, itk::Image< TPixel, VImageDimension > *output)
Copies an image from input to output, assuming input and output already allocated and of the same siz...
void ITKUpdateRegionGrowing(const itk::Image< TPixel, VImageDimension > *itkImage, bool skipUpdate, const mitk::Image *workingImage, const mitk::PointSet *seeds, mitk::ContourModelSet *segmentationContours, mitk::ContourModelSet *drawContours, mitk::ContourModelSet *polyContours, int sliceAxis, int sliceIndex, double lowerThreshold, double upperThreshold, mitk::Image *outputRegionGrowingImage)
Called from UpdateRegionGrowing(), updates the interactive ITK single 2D slice region growing pipelin...