X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkSegmentationUtils.h;h=7daf3c8345405463e12a47a459a5487da2847aa2;hb=1c1a921431ce1b0d80279211bd3a12fa9c4ae7bd;hp=468f9d891a6bc0a919a5d95a8de8a249f2c3c85f;hpb=f103c94b7b7e91450ac5cd0420713c8bbb8852bb;p=clitk.git diff --git a/itk/clitkSegmentationUtils.h b/itk/clitkSegmentationUtils.h index 468f9d8..7daf3c8 100644 --- a/itk/clitkSegmentationUtils.h +++ b/itk/clitkSegmentationUtils.h @@ -23,6 +23,7 @@ #include "clitkCommon.h" #include "clitkAutoCropFilter.h" #include "clitkLabelizeParameters.h" +#include "clitkExtractSliceFilter.h" // itk #include @@ -192,32 +193,52 @@ namespace clitk { typename ImageType::PixelType BG=0); template typename ImageType::Pointer - CropImageAbove(const ImageType * image, - int dim, double min, bool autoCrop = false, - typename ImageType::PixelType BG=0); + CropImageRemoveGreaterThan(const ImageType * image, + int dim, double min, bool autoCrop = false, + typename ImageType::PixelType BG=0); template typename ImageType::Pointer - CropImageBelow(const ImageType * image, - int dim, double max,bool autoCrop = false, - typename ImageType::PixelType BG=0); + CropImageRemoveLowerThan(const ImageType * image, + int dim, double max,bool autoCrop = false, + typename ImageType::PixelType BG=0); //-------------------------------------------------------------------- //-------------------------------------------------------------------- + template + typename itk::LabelMap< itk::ShapeLabelObject >::Pointer + ComputeLabelMap(const ImageType * image, + typename ImageType::PixelType BG, + bool computePerimeterFlag=false); template void ComputeCentroids(const ImageType * image, typename ImageType::PixelType BG, std::vector & centroids); + template + void + ComputeCentroids2(const ImageType * image, + typename ImageType::PixelType BG, + std::vector & centroids); //-------------------------------------------------------------------- //-------------------------------------------------------------------- template void - ExtractSlices(const ImageType * image, int dim, - std::vector< typename itk::Image::Pointer > & slices); + ExtractSlices(const ImageType * image, int direction, + std::vector::Pointer > & slices) + { + typedef ExtractSliceFilter ExtractSliceFilterType; + typedef typename ExtractSliceFilterType::SliceType SliceType; + typename ExtractSliceFilterType::Pointer + extractSliceFilter = ExtractSliceFilterType::New(); + extractSliceFilter->SetInput(image); + extractSliceFilter->SetDirection(direction); + extractSliceFilter->Update(); + extractSliceFilter->GetOutputSlices(slices); + } //-------------------------------------------------------------------- @@ -258,14 +279,20 @@ namespace clitk { typedef std::map MapPoint2DType; typedef std::vector VectorPoint3DType; + typedef std::vector VectorPoint2DType; + public: static void Convert2DTo3D(const PointType2D & p2D, const ImageType * image, const int slice, PointType3D & p3D); - static void Convert2DTo3DList(const MapPoint2DType & map, + static void Convert2DMapTo3DList(const MapPoint2DType & map, const ImageType * image, VectorPoint3DType & list); + static void Convert2DListTo3DList(const VectorPoint2DType & p, + int slice, + const ImageType * image, + VectorPoint3DType & list); }; //-------------------------------------------------------------------- @@ -297,6 +324,15 @@ namespace clitk { bool extendSupport); //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + template + typename ImageType::Pointer + Opening(const ImageType * image, typename ImageType::SizeType radius, + typename ImageType::PixelType BG, typename ImageType::PixelType FG); + //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template void ConvertOption(std::string optionName, uint given, @@ -362,6 +398,38 @@ namespace clitk { IsOnTheSameLineSide(PointType C, PointType A, PointType B, PointType like); //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + template + void + SliceBySliceBuildLineSegmentAccordingToExtremaPosition(const ImageType * input, + typename ImageType::PixelType BG, + int sliceDimension, + int extremaDirection, + bool extremaOppositeFlag, + int lineDirection, + double margin, + std::vector & A, + std::vector & B); + //-------------------------------------------------------------------- + + + //-------------------------------------------------------------------- + template + typename ImageType::Pointer + SliceBySliceKeepMainCCL(const ImageType * input, + typename ImageType::PixelType BG, + typename ImageType::PixelType FG); + //-------------------------------------------------------------------- + + + //-------------------------------------------------------------------- + template + typename ImageType::Pointer + Clone(const ImageType * input); + //-------------------------------------------------------------------- + + } #include "clitkSegmentationUtils.txx"