From: David Sarrut Date: Tue, 18 Oct 2011 09:50:51 +0000 (+0200) Subject: Add VerboseTracking for debug X-Git-Tag: v1.3.0~180^2~4 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=685bb891af7838fa8e52939fdc5208e05e1ca6f1;p=clitk.git Add VerboseTracking for debug --- diff --git a/segmentation/clitkExtractMediastinalVesselsFilter.h b/segmentation/clitkExtractMediastinalVesselsFilter.h index 44bb53a..0f3df6c 100644 --- a/segmentation/clitkExtractMediastinalVesselsFilter.h +++ b/segmentation/clitkExtractMediastinalVesselsFilter.h @@ -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; diff --git a/segmentation/clitkExtractMediastinalVesselsFilter.txx b/segmentation/clitkExtractMediastinalVesselsFilter.txx index 1781948..537b148 100644 --- a/segmentation/clitkExtractMediastinalVesselsFilter.txx +++ b/segmentation/clitkExtractMediastinalVesselsFilter.txx @@ -58,6 +58,7 @@ ExtractMediastinalVesselsFilter(): SetMaxDistanceRightToCarina(35); SetSoughtVesselSeedName("NoSeedNameGiven"); SetFinalOpeningRadius(1); + VerboseTrackingFlagOff(); } //-------------------------------------------------------------------- @@ -294,6 +295,10 @@ CropInputImage() { m_Input = clitk::CropImageRemoveLowerThan(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(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 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(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 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::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; diff --git a/segmentation/clitkExtractMediastinalVesselsGenericFilter.txx b/segmentation/clitkExtractMediastinalVesselsGenericFilter.txx index 71f8c6b..4a681a6 100644 --- a/segmentation/clitkExtractMediastinalVesselsGenericFilter.txx +++ b/segmentation/clitkExtractMediastinalVesselsGenericFilter.txx @@ -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);