]> Creatis software - clitk.git/commitdiff
itkv4 migration
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 13 Dec 2011 09:49:47 +0000 (10:49 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 13 Dec 2011 09:49:47 +0000 (10:49 +0100)
segmentation/clitkExtractLungFilter.txx

index f537fc1d2f5d483e33d3b9dfe7f6f33de4525c69..41e79677bf88c69ebf1788418fc144695f34587b 100644 (file)
@@ -700,17 +700,20 @@ SearchForTracheaSeed2(int numberOfSlices)
         writer->Update();
       }
 
-      typename LabelImageType::LabelObjectContainerType shapes_map = label_map->GetLabelObjectContainer();
-      typename LabelImageType::LabelObjectContainerType::const_iterator s;
       typename ShapeLabelType::Pointer shape, max_e_shape;
       double max_elongation = GetMaxElongation();
       double max_size = size[0]*size[1]/128;
       double max_e = 0;
       int nshapes = 0;
-      for (s = shapes_map.begin(); s != shapes_map.end(); s++) {
-        shape = s->second;
-        if (shape->GetSize() > 150 && shape->GetSize() <= max_size) {
+      unsigned int nlables = label_map->GetNumberOfLabelObjects();
+      for (unsigned int j = 0; j < nlables; j++) {
+        shape = label_map->GetNthLabelObject(j);
+        if (shape->Size() > 150 && shape->Size() <= max_size) {
+#if ITK_VERSION_MAJOR < 4
           double e = 1 - 1/shape->GetBinaryElongation();
+#else
+          double e = 1 - 1/shape->GetElongation();
+#endif
           //double area = 1 - r->Area() ;
           if (e < max_elongation) {
             nshapes++;