18 #ifndef itkMorphologicalContourInterpolator_h 19 #define itkMorphologicalContourInterpolator_h 21 #include "itkBinaryThresholdImageFilter.h" 22 #include "itkConnectedComponentImageFilter.h" 23 #include "itkExtractImageFilter.h" 24 #include "itkImageToImageFilter.h" 25 #include "itksys/hash_map.hxx" 64 template<
typename TImage >
66 public ImageToImageFilter< TImage, TImage >
68 template<
typename T >
78 using SliceType = Image<
typename TImage::PixelType, TImage::ImageDimension - 1 >;
184 typename TImage::PixelType label,
185 const std::vector< typename TImage::IndexValueType >& indices )
188 sliceSet.insert( indices.begin(), indices.end() );
241 ImagesEqual(
typename BoolSliceType::Pointer& a,
typename BoolSliceType::Pointer& b );
251 typename TImage::PixelType label,
252 typename TImage::IndexValueType i,
253 typename TImage::IndexValueType j,
254 typename SliceType::Pointer& iconn,
255 typename SliceType::Pointer& jconn );
263 InterpolateAlong(
int axis, TImage* out,
float startProgress,
float endProgress);
269 typename TImage::PixelType label,
270 typename TImage::IndexValueType i,
271 typename TImage::IndexValueType j,
272 typename SliceType::Pointer& iConn,
273 typename TImage::PixelType iRegionId );
276 typename FloatSliceType::Pointer
277 MaurerDM(
typename BoolSliceType::Pointer& inImage );
281 std::vector< typename BoolSliceType::Pointer >
283 typename BoolSliceType::Pointer& end );
286 typename BoolSliceType::Pointer
288 typename BoolSliceType::Pointer& iMask,
289 typename BoolSliceType::Pointer& jMask );
292 typename BoolSliceType::Pointer
294 typename BoolSliceType::Pointer& iMask,
295 typename BoolSliceType::Pointer& jMask );
301 typename TImage::PixelType label,
302 typename TImage::IndexValueType i,
303 typename TImage::IndexValueType j,
304 typename SliceType::Pointer& iConn,
305 typename TImage::PixelType iRegionId,
306 typename SliceType::Pointer& jConn,
307 typename TImage::PixelType jRegionId,
308 const typename SliceType::IndexType& translation,
311 using PixelList = std::vector< typename TImage::PixelType >;
317 typename TImage::PixelType label,
318 typename TImage::IndexValueType i,
319 typename TImage::IndexValueType j,
320 typename SliceType::Pointer& iConn,
321 typename TImage::PixelType iRegionId,
322 typename SliceType::Pointer& jConn,
324 const typename SliceType::IndexType& translation );
327 typename SliceType::Pointer
329 const typename SliceType::IndexType& translation,
330 typename SliceType::RegionType newRegion );
342 typename SliceType::IndexType
349 typename SliceType::RegionType& iRegion,
350 typename SliceType::RegionType& jRegion );
355 typename TImage::PixelType iRegionId,
356 typename SliceType::Pointer& jConn,
358 const typename SliceType::IndexType& translation );
361 typename SliceType::IndexType
362 Align(
typename SliceType::Pointer& iConn,
363 typename TImage::PixelType iRegionId,
364 typename SliceType::Pointer& jConn,
367 using BoundingBoxesType = itksys::hash_map< typename TImage::PixelType, typename TImage::RegionType >;
371 typename SliceType::RegionType
372 BoundingBox( itk::SmartPointer< SliceType > image );
377 template<
typename T2 >
379 ExpandRegion(
typename T2::RegionType& region,
const typename T2::IndexType& index );
382 typename SliceType::Pointer
384 typename TImage::PixelType label,
385 IdentifierType& objectCount );
388 typename BoolSliceType::Pointer
389 Dilate1(
typename BoolSliceType::Pointer& seed,
typename BoolSliceType::Pointer& mask );
391 using RoiType = ExtractImageFilter< TImage, SliceType >;
394 using BinarizerType = BinaryThresholdImageFilter< SliceType, BoolSliceType >;
402 #ifndef ITK_MANUAL_INSTANTIATION 403 #include "itkMorphologicalContourInterpolator.hxx" 406 #endif // itkMorphologicalContourInterpolator_h SliceType::Pointer RegionedConnectedComponents(const typename TImage::RegionType ®ion, typename TImage::PixelType label, IdentifierType &objectCount)
IdentifierType m_MinAlignIters
BinarizerType::Pointer m_Binarizer
Image< bool, TImage::ImageDimension > BoolImageType
friend class MorphologicalContourInterpolatorParallelInvoker
void IntersectionRegions(const typename SliceType::IndexType &translation, typename SliceType::RegionType &iRegion, typename SliceType::RegionType &jRegion)
void InterpolateBetweenTwo(int axis, TImage *out, typename TImage::PixelType label, typename TImage::IndexValueType i, typename TImage::IndexValueType j, typename SliceType::Pointer &iconn, typename SliceType::Pointer &jconn)
Image< float, TImage::ImageDimension - 1 > FloatSliceType
SliceSetType GetLabeledSliceIndices(unsigned int axis, typename TImage::PixelType label)
itkSetMacro(Label, typename TImage::PixelType)
void GenerateData() override
TImage::PixelType m_Label
void AllocateOutputs() override
Simplified inverse ITK transforms.
ConnectedComponentsType::Pointer m_ConnectedComponents
itkTypeMacro(MorphologicalContourInterpolator, ImageToImageFilter)
std::set< typename TImage::IndexValueType > SliceSetType
SmartPointer< Self > Pointer
bool m_HeuristicAlignment
void SetLabeledSliceIndices(unsigned int axis, typename TImage::PixelType label, const std::vector< typename TImage::IndexValueType > &indices)
MorphologicalContourInterpolator()
void Interpolate1toN(int axis, TImage *out, typename TImage::PixelType label, typename TImage::IndexValueType i, typename TImage::IndexValueType j, typename SliceType::Pointer &iConn, typename TImage::PixelType iRegionId, typename SliceType::Pointer &jConn, const PixelList &jRegionIds, const typename SliceType::IndexType &translation)
std::vector< typename TImage::PixelType > PixelList
void DetermineSliceOrientations()
bool m_UseBallStructuringElement
itkGetConstMacro(Label, typename TImage::PixelType)
bool ImagesEqual(typename BoolSliceType::Pointer &a, typename BoolSliceType::Pointer &b)
std::vector< typename BoolSliceType::Pointer > GenerateDilationSequence(typename BoolSliceType::Pointer &begin, typename BoolSliceType::Pointer &end)
SliceType::IndexType Centroid(typename SliceType::Pointer &conn, const PixelList ®ionIds)
ImageToImageFilter< TImage, TImage > Superclass
bool m_UseCustomSlicePositions
SliceType::Pointer TranslateImage(typename SliceType::Pointer &image, const typename SliceType::IndexType &translation, typename SliceType::RegionType newRegion)
itksys::hash_map< typename TImage::PixelType, typename TImage::RegionType > BoundingBoxesType
BoolSliceType::Pointer FindMedianImageDilations(typename BoolSliceType::Pointer &intersection, typename BoolSliceType::Pointer &iMask, typename BoolSliceType::Pointer &jMask)
~MorphologicalContourInterpolator() override=default
void SetUseBallStructuringElement(bool useBall)
BinaryThresholdImageFilter< SliceType, BoolSliceType > BinarizerType
itksys::hash_map< typename TImage::PixelType, SliceSetType > LabeledSlicesType
Interpolates contours between slices. Based on a paper by Albu et al.
SliceIndicesType m_LabeledSlices
Image< bool, TImage::ImageDimension - 1 > BoolSliceType
IdentifierType m_ThreadCount
BoolSliceType::Pointer Dilate1(typename BoolSliceType::Pointer &seed, typename BoolSliceType::Pointer &mask)
void Extrapolate(int axis, TImage *out, typename TImage::PixelType label, typename TImage::IndexValueType i, typename TImage::IndexValueType j, typename SliceType::Pointer &iConn, typename TImage::PixelType iRegionId)
BoolSliceType::Pointer FindMedianImageDistances(typename BoolSliceType::Pointer &intersection, typename BoolSliceType::Pointer &iMask, typename BoolSliceType::Pointer &jMask)
std::vector< LabeledSlicesType > SliceIndicesType
ConnectedComponentImageFilter< BoolSliceType, SliceType > ConnectedComponentsType
ITK_DISALLOW_COPY_AND_ASSIGN(MorphologicalContourInterpolator)
SliceIndicesType GetLabeledSliceIndices()
IdentifierType m_MaxAlignIters
void ExpandRegion(typename T2::RegionType ®ion, const typename T2::IndexType &index)
itkGetMacro(Label, typename TImage::PixelType)
void SetLabeledSliceIndices(unsigned int axis, typename TImage::PixelType label, const SliceSetType &indices)
IdentifierType CardinalSymmetricDifference(typename BoolSliceType::Pointer &shape1, typename BoolSliceType::Pointer &shape2)
void Interpolate1to1(int axis, TImage *out, typename TImage::PixelType label, typename TImage::IndexValueType i, typename TImage::IndexValueType j, typename SliceType::Pointer &iConn, typename TImage::PixelType iRegionId, typename SliceType::Pointer &jConn, typename TImage::PixelType jRegionId, const typename SliceType::IndexType &translation, bool recursive)
FloatSliceType::Pointer MaurerDM(typename BoolSliceType::Pointer &inImage)
ExtractImageFilter< TImage, SliceType > RoiType
BoundingBoxesType m_BoundingBoxes
Image< typename TImage::PixelType, TImage::ImageDimension - 1 > SliceType
SliceType::IndexType Align(typename SliceType::Pointer &iConn, typename TImage::PixelType iRegionId, typename SliceType::Pointer &jConn, const PixelList &jRegionIds)
void InterpolateAlong(int axis, TImage *out, float startProgress, float endProgress)
SliceType::RegionType BoundingBox(itk::SmartPointer< SliceType > image)
IdentifierType Intersection(typename SliceType::Pointer &iConn, typename TImage::PixelType iRegionId, typename SliceType::Pointer &jConn, const PixelList &jRegionIds, const typename SliceType::IndexType &translation)
void ClearLabeledSliceIndices()
bool m_UseDistanceTransform