X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkSegmentationUtils.h;h=3b388cba025d1bad9b1a5e40215cab91d6ffb86c;hb=62c08c838c8d824b37b908bbed67b996aaaa31ac;hp=09b0844a7271f36cb071da0cf6f542ea097eec06;hpb=48f513811d9b13e6c7df67d8dc16fa073aa0751a;p=clitk.git diff --git a/itk/clitkSegmentationUtils.h b/itk/clitkSegmentationUtils.h index 09b0844..3b388cb 100644 --- a/itk/clitkSegmentationUtils.h +++ b/itk/clitkSegmentationUtils.h @@ -19,9 +19,12 @@ #ifndef CLITKSEGMENTATIONUTILS_H #define CLITKSEGMENTATIONUTILS_H +// clitk #include "clitkCommon.h" #include "clitkAutoCropFilter.h" #include "clitkLabelizeParameters.h" + +// itk #include namespace clitk { @@ -31,7 +34,7 @@ namespace clitk { void ComputeBBFromImageRegion(typename ImageType::Pointer image, typename ImageType::RegionType region, typename itk::BoundingBox::Pointer bb); + ImageType::ImageDimension>::Pointer bb); //-------------------------------------------------------------------- template @@ -48,32 +51,25 @@ namespace clitk { //-------------------------------------------------------------------- template typename TInternalImageType::Pointer - SetBackground(typename TInternalImageType::ConstPointer input, - typename TMaskInternalImageType::ConstPointer mask, + SetBackground(const TInternalImageType * input, + const TMaskInternalImageType * mask, typename TMaskInternalImageType::PixelType maskBG, typename TInternalImageType::PixelType outValue); //-------------------------------------------------------------------- - + //-------------------------------------------------------------------- - template - typename TInternalImageType::Pointer - SetBackground(typename TInternalImageType::Pointer input, - typename TMaskInternalImageType::Pointer mask, - typename TMaskInternalImageType::PixelType maskBG, - typename TInternalImageType::PixelType outValue) { - return SetBackground - (static_cast(input), - static_cast(mask), - maskBG, outValue); - } + template + int GetNumberOfConnectedComponentLabels(typename ImageType::Pointer input, + typename ImageType::PixelType BG, + bool isFullyConnected); //-------------------------------------------------------------------- //-------------------------------------------------------------------- template typename TImageType::Pointer - Labelize(typename TImageType::Pointer input, + Labelize(const TImageType * input, typename TImageType::PixelType BG, bool isFullyConnected, int minimalComponentSize); @@ -91,23 +87,23 @@ namespace clitk { //-------------------------------------------------------------------- template - typename ImageType::Pointer - AutoCrop(typename ImageType::Pointer input, - typename ImageType::PixelType BG) { - typedef clitk::AutoCropFilter AutoCropFilterType; - typename AutoCropFilterType::Pointer autoCropFilter = AutoCropFilterType::New(); - autoCropFilter->SetInput(input); - autoCropFilter->Update(); - return autoCropFilter->GetOutput(); + typename ImageType::Pointer + AutoCrop(typename ImageType::Pointer input, + typename ImageType::PixelType BG) { + typedef clitk::AutoCropFilter AutoCropFilterType; + typename AutoCropFilterType::Pointer autoCropFilter = AutoCropFilterType::New(); + autoCropFilter->SetInput(input); + autoCropFilter->SetBackgroundValue(BG); + autoCropFilter->Update(); + return autoCropFilter->GetOutput(); } - //-------------------------------------------------------------------- //-------------------------------------------------------------------- template typename TImageType::Pointer - KeepLabels(typename TImageType::Pointer input, + KeepLabels(const TImageType * input, typename TImageType::PixelType BG, typename TImageType::PixelType FG, typename TImageType::PixelType firstKeep, @@ -129,10 +125,48 @@ namespace clitk { //-------------------------------------------------------------------- template typename ImageType::Pointer - EnlargeImageLike(typename ImageType::Pointer input, - typename ImageType::Pointer like, - typename ImageType::PixelType BG); + ResizeImageLike(typename ImageType::Pointer input, + typename ImageType::Pointer like, + typename ImageType::PixelType BG); + + //-------------------------------------------------------------------- + template + typename MaskImageType::Pointer + SliceBySliceRelativePosition(const MaskImageType * input, + const MaskImageType * object, + int direction, + double threshold, + std::string orientation, + bool uniqueConnectedComponent=false, + double spacing=-1, + bool notflag=false); + + //-------------------------------------------------------------------- + // In a binary image, search for the point belonging to the FG that + // is the most exterma in the direction 'direction' (or in the + // opposite if notFlag is given). if 'point' and 'distanceMax' are + // given, do not consider points that are away from 'point' more + // than 'distanceMax' + template + typename SliceType::PointType + FindExtremaPointInAGivenDirection(const SliceType * input, + typename SliceType::PixelType bg, + int direction, + bool notFlag, + typename SliceType::PointType point, + double distanceMax); + + //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + template + typename ImageType::Pointer + CropImageAlongOneAxis(typename ImageType::Pointer image, + int dim, double min, double max, + bool autoCrop = false, + typename ImageType::PixelType BG=0); + //-------------------------------------------------------------------- } #include "clitkSegmentationUtils.txx"