]> Creatis software - clitk.git/commitdiff
Add VerboseTracking for debug
authorDavid Sarrut <david.sarrut@gmail.com>
Tue, 18 Oct 2011 09:50:51 +0000 (11:50 +0200)
committerDavid Sarrut <david.sarrut@gmail.com>
Tue, 18 Oct 2011 09:50:51 +0000 (11:50 +0200)
segmentation/clitkExtractMediastinalVesselsFilter.h
segmentation/clitkExtractMediastinalVesselsFilter.txx
segmentation/clitkExtractMediastinalVesselsGenericFilter.txx

index 44bb53af2fe267e2d9a6b3db6a62efe81b477616..0f3df6cbf09c41bb942b5d87c622fd2ea90d507a 100644 (file)
@@ -113,6 +113,10 @@ namespace clitk {
     itkGetConstMacro(DebugFlag, bool);
     itkBooleanMacro(DebugFlag);
 
+    itkSetMacro(VerboseTrackingFlag, bool);
+    itkGetConstMacro(VerboseTrackingFlag, bool);
+    itkBooleanMacro(VerboseTrackingFlag);
+
     itkSetMacro(SoughtVesselSeedName, std::string);
     itkGetConstMacro(SoughtVesselSeedName, std::string);
 
@@ -137,6 +141,7 @@ namespace clitk {
     virtual void GenerateData();
     
     bool               m_DebugFlag;
+    bool               m_VerboseTrackingFlag;
     ImagePointer       m_Input;
     MaskImagePointer   m_Working_Support;
     MaskImagePointer   m_Mediastinum;
index 178194871e3b536e5b8755ec71167248dee8d40a..537b14867b1d3cfa74692b8e4326f4d65873f04f 100644 (file)
@@ -58,6 +58,7 @@ ExtractMediastinalVesselsFilter():
   SetMaxDistanceRightToCarina(35);
   SetSoughtVesselSeedName("NoSeedNameGiven");
   SetFinalOpeningRadius(1);
+  VerboseTrackingFlagOff();
 }
 //--------------------------------------------------------------------
 
@@ -294,6 +295,10 @@ CropInputImage() {
   m_Input = 
     clitk::CropImageRemoveLowerThan<ImageType>(m_Input, 2, m_CarinaZ, false, GetBackgroundValue());  
 
+  // // Get seed, crop around
+  // MaskImagePointType SoughtVesselSeedPoint;
+  // GetAFDB()->GetPoint3D(m_SoughtVesselSeedName, SoughtVesselSeedPoint);
+
   // Crop post
   double m_CarinaY = centroids[1][1];
   m_Input = clitk::CropImageRemoveGreaterThan<ImageType>(m_Input, 1,
@@ -359,9 +364,20 @@ TrackBifurcationFromPoint(MaskImagePointer & recon,
   uint currentSlice=index[2]; 
   bool found = false;
   LabelType previous_slice_label=recon->GetPixel(index);
+
+
+  if (GetVerboseTrackingFlag()) {
+    std::cout << "TrackBifurcationFromPoint " << std::endl;
+    std::cout << "\t point3D = " << point3D << std::endl;
+    std::cout << "\t pointMaxSlice = " << pointMaxSlice << std::endl;
+    std::cout << "\t newLabel = " << newLabel << std::endl;
+  }
+
   //  DD(slices_recon.size());
   do {
-    //    DD(currentSlice);
+    if (GetVerboseTrackingFlag()) {
+      std::cout << "currentSlice = " << currentSlice << std::endl;
+    }
     // Consider current reconstructed slice
     MaskSlicePointer s = slices_recon[currentSlice];
     MaskSlicePointer previous;
@@ -413,7 +429,10 @@ TrackBifurcationFromPoint(MaskImagePointer & recon,
     // -------------------------
     // If no centroid were found
     if (centroids.size() == 0) {
-      // Last attempt to find -> check if previous centroid is inside a CCL
+      if (GetVerboseTrackingFlag()) {
+        std::cout << "no centroid" << std::endl;
+      }
+       // Last attempt to find -> check if previous centroid is inside a CCL
       //      if in s -> get value, getcentroid add.
       //      DD(currentSlice);
       //DD("Last change to find");
@@ -434,6 +453,9 @@ TrackBifurcationFromPoint(MaskImagePointer & recon,
     // Some centroid were found
     // If several centroids, we found a bifurcation
     if (centroids.size() > 1) {
+      if (GetVerboseTrackingFlag()) {
+        std::cout << "Centroid" << centroids.size() << std::endl;
+      }
       //      int n = centroids.size();
       // Debug point
       std::vector<ImagePointType> d;
@@ -498,6 +520,10 @@ TrackBifurcationFromPoint(MaskImagePointer & recon,
     
     // if only one centroids, we change the current image with the current label 
     if (centroids.size() == 1) {
+      if (GetVerboseTrackingFlag()) {
+        std::cout << "Centroid" << centroids.size() << std::endl;
+      }
+      
       //DD(centroids_label[0]);
       s = clitk::SetBackground<MaskSliceType, MaskSliceType>(s, s, centroids_label[0], newLabel, true);
       slices_recon[currentSlice] = s;
@@ -534,6 +560,10 @@ TrackBifurcationFromPoint(MaskImagePointer & recon,
       previousCenter = centroids[1];
     }
 
+    if (GetVerboseTrackingFlag()) {
+        std::cout << "End iteration c=" << centroids.size() << std::endl;
+    }
+    
     if (centroids.size() == 0) {
       //      DD("ZERO");
       found = true;
@@ -598,6 +628,13 @@ TrackVesselsFromPoint(MaskImagePointer & recon,
   std::vector<MaskSlicePointer> shapeObjectsSliceList; // keep slice, useful for 'union'
   typename LabelObjectType::Pointer previousShapeObject;
 
+ if (GetVerboseTrackingFlag()) {
+    std::cout << "TrackBifurcationFromPoint " << std::endl;
+    std::cout << "\t seedPoint = " << seedPoint << std::endl;
+    std::cout << "\t pointMaxSlice = " << pointMaxSlice << std::endl;
+    std::cout << "\t newLabel = " << newLabel << std::endl;
+  }
+
   do {
     // Debug
     //std::cout << std::endl;
@@ -606,6 +643,10 @@ TrackVesselsFromPoint(MaskImagePointer & recon,
     clitk::PointsUtils<MaskImageType>::Convert2DTo3D(previousCentroid, m_Mask, currentSlice-1, c);
     //DD(c);
 
+    if (GetVerboseTrackingFlag()) {
+      std::cout << "Loop slice = " << currentSlice << " c = " << c << std::endl;
+    }
+
     // Consider current reconstructed slice
     MaskSlicePointer s = slices[currentSlice];
     MaskSlicePointer previous;
index 71f8c6b7ec0713e6717dc30a3dbad219880c3283..4a681a6d2fad3a599efe58359221119fe5c74244 100644 (file)
@@ -83,6 +83,8 @@ SetOptionsFromArgsInfoToFilter(FilterType * f)
   f->SetMaxNumberOfFoundBifurcation(mArgsInfo.bif_arg);
 
   f->SetFinalOpeningRadius(mArgsInfo.open_arg);
+
+  f->SetVerboseTrackingFlag(mArgsInfo.verboseTracking_flag);
   
   // Output filename
   this->AddOutputFilename(mArgsInfo.output_arg);