X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractMediastinalVesselsFilter.txx;h=537b14867b1d3cfa74692b8e4326f4d65873f04f;hb=e3dfdd2305abb337638468aaca3d9b20718b5026;hp=29709f48df1d8fc6bb95f85b8f7af80c02afb8ce;hpb=25a1e4fa1187d00dda0c8bcce573ea02e811dbc9;p=clitk.git diff --git a/segmentation/clitkExtractMediastinalVesselsFilter.txx b/segmentation/clitkExtractMediastinalVesselsFilter.txx index 29709f4..537b148 100644 --- a/segmentation/clitkExtractMediastinalVesselsFilter.txx +++ b/segmentation/clitkExtractMediastinalVesselsFilter.txx @@ -58,6 +58,7 @@ ExtractMediastinalVesselsFilter(): SetMaxDistanceRightToCarina(35); SetSoughtVesselSeedName("NoSeedNameGiven"); SetFinalOpeningRadius(1); + VerboseTrackingFlagOff(); } //-------------------------------------------------------------------- @@ -213,7 +214,7 @@ GenerateOutputInformation() { // Build the final 3D image from the previous slice by slice processing m_SoughtVessel = clitk::JoinSlices(m_slice_recon, m_Mask, 2); - writeImage(m_SoughtVessel, "recon2.mhd"); + // writeImage(m_SoughtVessel, "recon2.mhd"); // Set binary image, (remove other labels). m_SoughtVessel = @@ -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,14 +628,25 @@ 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; + //std::cout << std::endl; //DD(currentSlice); ImagePointType c; 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;