X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLymphStation_8.txx;h=fc39203ebf7ee646fbc2b169adfad864d9aabd92;hb=14f4edb429bfea126aa215eeb0aaf7d1ebbae5b0;hp=dd3fdca3cafcf96622b035e4a42f9999c693cb6f;hpb=a339bdc482ea9752ec53195bc9a47e8b05dba582;p=clitk.git diff --git a/segmentation/clitkExtractLymphStation_8.txx b/segmentation/clitkExtractLymphStation_8.txx index dd3fdca..fc39203 100644 --- a/segmentation/clitkExtractLymphStation_8.txx +++ b/segmentation/clitkExtractLymphStation_8.txx @@ -14,7 +14,7 @@ ExtractStation_8_SetDefaultValues() SetEsophagusDiltationForAnt(p); p[0] = 5; p[1] = 10; p[2] = 1; SetEsophagusDiltationForRight(p); - SetFuzzyThresholdForS8(0.5); + SetFuzzyThreshold("8", "Esophagus", 0.5); SetInjectedThresholdForS8(150); } //-------------------------------------------------------------------- @@ -163,9 +163,9 @@ ExtractStation_8_Post_Limits() // Convert 2D points in slice into 3D points std::vector vertebralAntPositions; - clitk::PointsUtils::Convert2DTo3DList(vertebralAntPositionBySlice, - VertebralBody, - vertebralAntPositions); + clitk::PointsUtils::Convert2DMapTo3DList(vertebralAntPositionBySlice, + VertebralBody, + vertebralAntPositions); // DEBUG : write list of points clitk::WriteListOfLandmarks(vertebralAntPositions, @@ -241,7 +241,7 @@ ExtractStation_8_Ant_Sup_Limits() MaskImagePointer Trachea = GetAFDB()->template GetImage("Trachea"); MaskImagePointer m_Working_Trachea = - clitk::CropImageAbove(Trachea, 2, m_CarinaZ, true, // AutoCrop + clitk::CropImageRemoveGreaterThan(Trachea, 2, m_CarinaZ, true, // AutoCrop GetBackgroundValue()); // Seprate into two main bronchi @@ -322,12 +322,12 @@ ExtractStation_8_Ant_Sup_Limits() OriginOfRightMiddleLobeBronchus->Delete(); RightBronchus = - clitk::CropImageBelow(RightBronchus, 2, + clitk::CropImageRemoveLowerThan(RightBronchus, 2, m_OriginOfRightMiddleLobeBronchusZ, true, // AutoCrop GetBackgroundValue()); LeftBronchus = - clitk::CropImageBelow(LeftBronchus, 2, + clitk::CropImageRemoveLowerThan(LeftBronchus, 2, m_OriginOfRightMiddleLobeBronchusZ, true, // AutoCrop GetBackgroundValue()); @@ -431,7 +431,7 @@ ExtractStation_8_Ant_Inf_Limits() // Crop Esophagus : keep only below the OriginOfRightMiddleLobeBronchusZ m_Esophagus = - clitk::CropImageAbove(m_Esophagus, 2, + clitk::CropImageRemoveGreaterThan(m_Esophagus, 2, m_OriginOfRightMiddleLobeBronchusZ, true, // AutoCrop GetBackgroundValue()); @@ -462,13 +462,13 @@ ExtractStation_8_Ant_Inf_Limits() relPosFilter->WriteStepFlagOff(); relPosFilter->SetInput(m_Working_Support); relPosFilter->SetInputObject(m_Esophagus); - relPosFilter->AddOrientationTypeString("P"); - relPosFilter->InverseOrientationFlagOff(); + relPosFilter->AddOrientationTypeString("PostTo"); + // relPosFilter->InverseOrientationFlagOff(); relPosFilter->SetDirection(2); // Z axis relPosFilter->UniqueConnectedComponentBySliceOff(); relPosFilter->SetIntermediateSpacing(3); relPosFilter->IntermediateSpacingFlagOn(); - relPosFilter->SetFuzzyThreshold(GetFuzzyThresholdForS8()); + relPosFilter->SetFuzzyThreshold(GetFuzzyThreshold("8", "Esophagus")); relPosFilter->RemoveObjectFlagOff(); // Do not exclude here because it is dilated relPosFilter->CombineWithOrFlagOff(); // NO ! relPosFilter->IgnoreEmptySliceObjectFlagOn(); @@ -635,7 +635,7 @@ clitk::ExtractLymphStationsFilter:: ExtractStation_8_Single_CCL_Limits() { //-------------------------------------------------------------------- - StartNewStep("[Station8] Single CCL"); + StartNewStep("[Station8 or 3P] Slice by slice, keep a single CCL (the closest to VertebralBody)"); // Consider slices std::vector slices; @@ -654,15 +654,11 @@ ExtractStation_8_Single_CCL_Limits() std::vector c; clitk::ComputeCentroids(slices[i], GetBackgroundValue(), centroids); clitk::ComputeCentroids(slices_vb[i], GetBackgroundValue(), c); - // DD(c.size()); - // DD(centroids.size()); if ((c.size() > 1) && (centroids.size() > 1)) { // keep the one which is the closer to vertebralbody centroid double distance=1000000; int index=0; - // DD(c[1]); for(uint j=1; j c; clitk::ComputeCentroids(eso_slices[i], GetBackgroundValue(), c); if (c.size() >1) { - // DD(c[1]); eso_slices[i] = - clitk::CropImageAbove(eso_slices[i], 1, c[1][1], false, GetBackgroundValue()); + clitk::CropImageRemoveGreaterThan(eso_slices[i], 1, c[1][1], false, GetBackgroundValue()); eso_slices[i] = clitk::ResizeImageLike(eso_slices[i], aorta_slices[i], GetBackgroundValue()); // writeImage(eso_slices[i], "eso-slice-"+toString(i)+".mhd"); @@ -1041,12 +1036,11 @@ ExtractStation_8_LR_Limits() j++; } } - // DD(j); sp_MostAntVertebralBody[1] += GetDistanceMaxToAnteriorPartOfTheSpine(); // Consider offset // Crop the vertebralbody below this most post line vert_slices[j] = - clitk::CropImageAbove(vert_slices[j], 1, sp_MostAntVertebralBody[1], false, GetBackgroundValue()); + clitk::CropImageRemoveGreaterThan(vert_slices[j], 1, sp_MostAntVertebralBody[1], false, GetBackgroundValue()); vert_slices[j] = clitk::ResizeImageLike(vert_slices[j], aorta_slices[i], GetBackgroundValue()); // writeImage(vert_slices[i], "vert-slice-"+toString(i)+".mhd"); @@ -1065,8 +1059,6 @@ ExtractStation_8_LR_Limits() clitk::PointsUtils::Convert2DTo3D(sp_MostLeftVertebralBody, VertebralBody, i, p); p_MostLeftVertebralBody.push_back(p); - // DD(p_MostLeftVertebralBody.back()); - /* ------------------------------------------------------------------------------------- Find most Left point in Esophagus */ @@ -1082,14 +1074,12 @@ ExtractStation_8_LR_Limits() // p_MostLeftEsophagus.push_back(p); // sp_MostLeftEsophagus = sp_temp; // Retrieve previous 2D position // found = true; - // DD(p); // } } else { clitk::PointsUtils::Convert2DTo3D(sp_MostLeftEsophagus, EsophagusForSlice, i, p); p_MostLeftEsophagus.push_back(p); // sp_temp = sp_MostLeftEsophagus; // Store previous 2D position - // // DD(p_MostLeftEsophagus.back()); } /* ------------------------------------------------------------------------------------- @@ -1141,11 +1131,8 @@ ExtractStation_8_Remove_Structures() //-------------------------------------------------------------------- StartNewStep("[Station8] remove some structures"); - MaskImagePointer Aorta = GetAFDB()->template GetImage("Aorta"); - clitk::AndNot(m_Working_Support, Aorta, GetBackgroundValue()); - - MaskImagePointer Esophagus = GetAFDB()->template GetImage("Esophagus"); - clitk::AndNot(m_Working_Support, Esophagus, GetBackgroundValue()); + Remove_Structures("8", "Aorta"); + Remove_Structures("8", "Esophagus"); // END StopCurrentStep(m_Working_Support); @@ -1174,7 +1161,7 @@ EnlargeEsophagusDilatationRadiusInferiorly(MaskImagePointer & Esophagus) clitk::FindExtremaPointInAGivenDirection(Esophagus, GetBackgroundValue(), 2, true, pt); DD(pt); Esophagus = - clitk::CropImageBelow(Esophagus, 2, + clitk::CropImageRemoveLowerThan(Esophagus, 2, pt[2], false, // AutoCrop GetBackgroundValue()); @@ -1243,8 +1230,8 @@ ExtractStation_8_LR_Limits_old() relPosFilter->WriteStepFlagOff(); relPosFilter->SetInput(m_Working_Support); relPosFilter->SetInputObject(Esophagus); - relPosFilter->AddOrientationTypeString("L"); - relPosFilter->InverseOrientationFlagOn(); // Not Left to + relPosFilter->AddOrientationTypeString("NotLeftTo"); + // relPosFilter->InverseOrientationFlagOn(); // Not Left to relPosFilter->SetDirection(2); // Z axis relPosFilter->UniqueConnectedComponentBySliceOff(); // important relPosFilter->SetIntermediateSpacing(4);