From: dsarrut Date: Mon, 2 May 2011 09:13:18 +0000 (+0200) Subject: Change Above/Below with Greater/Lower X-Git-Tag: v1.2.0^2~9 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cbc17503754431d6529addee9e37ef955e88fd68;p=clitk.git Change Above/Below with Greater/Lower --- diff --git a/itk/clitkSegmentationUtils.h b/itk/clitkSegmentationUtils.h index 5aa9b9a..532abd7 100644 --- a/itk/clitkSegmentationUtils.h +++ b/itk/clitkSegmentationUtils.h @@ -192,14 +192,14 @@ 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); //-------------------------------------------------------------------- diff --git a/itk/clitkSegmentationUtils.txx b/itk/clitkSegmentationUtils.txx index 7acec20..16c184c 100644 --- a/itk/clitkSegmentationUtils.txx +++ b/itk/clitkSegmentationUtils.txx @@ -420,7 +420,7 @@ namespace clitk { //-------------------------------------------------------------------- template typename ImageType::Pointer - CropImageAbove(const ImageType * image, + CropImageRemoveGreaterThan(const ImageType * image, int dim, double min, bool autoCrop, typename ImageType::PixelType BG) { @@ -435,7 +435,7 @@ namespace clitk { //-------------------------------------------------------------------- template typename ImageType::Pointer - CropImageBelow(const ImageType * image, + CropImageRemoveLowerThan(const ImageType * image, int dim, double max, bool autoCrop, typename ImageType::PixelType BG) { @@ -508,9 +508,12 @@ namespace clitk { centroids.clear(); typename ImageType::PointType dummy; - centroids.push_back(dummy); // label 0 -> no centroid, use dummy point - for(uint i=1; iGetNumberOfLabelObjects()+1; i++) { - centroids.push_back(labelMap->GetLabelObject(i)->GetCentroid()); + centroids.push_back(dummy); // label 0 -> no centroid, use dummy point for BG + //DS FIXME (not useful ! to change ..) + DD(labelMap->GetNumberOfLabelObjects()); + for(uint i=0; iGetNumberOfLabelObjects(); i++) { + int label = labelMap->GetLabels()[i]; + centroids.push_back(labelMap->GetLabelObject(label)->GetCentroid()); } } //-------------------------------------------------------------------- @@ -879,6 +882,7 @@ namespace clitk { typedef itk::BinaryThresholdImageFilter BinaryThresholdFilterType; typename BinaryThresholdFilterType::Pointer binarizeFilter = BinaryThresholdFilterType::New(); binarizeFilter->SetInput(input); + binarizeFilter->InPlaceOff(); binarizeFilter->SetLowerThreshold(lower); binarizeFilter->SetUpperThreshold(upper); binarizeFilter->SetInsideValue(FG);