3 //--------------------------------------------------------------------
4 template <class ImageType>
6 clitk::ExtractLymphStationsFilter<ImageType>::
7 ExtractStation_4RL_SetDefaultValues()
10 //--------------------------------------------------------------------
13 //--------------------------------------------------------------------
14 template <class TImageType>
16 clitk::ExtractLymphStationsFilter<TImageType>::
17 ExtractStation_4RL() {
18 if ((!CheckForStation("4R")) && (!CheckForStation("4L"))) return;
20 StartNewStep("Stations 4RL");
23 // Get the current support
24 StartNewStep("[Station 4RL] Get the current 4RL suppport");
25 m_ListOfStations["4R"] = m_ListOfSupports["S4R"];
26 m_ListOfStations["4L"] = m_ListOfSupports["S4L"];
27 StopCurrentStep<MaskImageType>(m_ListOfStations["4R"]);
29 // Generic RelativePosition processes
30 m_ListOfStations["4R"] = this->ApplyRelativePositionList("Station_4R", m_ListOfStations["4R"]);
31 m_ListOfStations["4L"] = this->ApplyRelativePositionList("Station_4L", m_ListOfStations["4L"]);
33 // Separation Ant/Post
34 m_Working_Support = m_ListOfStations["4L"];
35 ExtractStation_S4L_S5_Limits_Aorta_LeftPulmonaryArtery(10);
36 m_ListOfStations["4L"] = m_Working_Support;
38 // Keep only one single CCL by slice
39 StartNewStep("[Station 4L] Keep only one CCL by slice");
40 m_ListOfStations["4L"] = SliceBySliceKeepMainCCL<MaskImageType>(m_ListOfStations["4L"],
42 GetForegroundValue());
43 StopCurrentStep<MaskImageType>(m_ListOfStations["4L"]);
45 // Store image filenames into AFDB
46 writeImage<MaskImageType>(m_ListOfStations["4R"], "seg/Station4R.mhd");
47 writeImage<MaskImageType>(m_ListOfStations["4L"], "seg/Station4L.mhd");
48 GetAFDB()->SetImageFilename("Station4R", "seg/Station4R.mhd");
49 GetAFDB()->SetImageFilename("Station4L", "seg/Station4L.mhd");
54 //--------------------------------------------------------------------
57 //--------------------------------------------------------------------
58 template <class TImageType>
60 clitk::ExtractLymphStationsFilter<TImageType>::
61 ExtractStation_S4L_S5_Limits_Aorta_LeftPulmonaryArtery(int KeepPoint)
63 // ----------------------------------------------------------
64 StartNewStep("[Station 4L] Limits between Asc and Desc Aorta, and with LeftPulmonaryArtery ");
66 // Separate Aorta into DescendingAorta AscendingAorta
67 MaskImagePointer AscendingAorta = GetAFDB()->template GetImage<MaskImageType>("AscendingAorta");
68 MaskImagePointer DescendingAorta = GetAFDB()->template GetImage<MaskImageType>("DescendingAorta");
70 // Crop like support (inferiorly)
71 m_Working_Support = clitk::AutoCrop<MaskImageType>(m_Working_Support, GetBackgroundValue());
73 clitk::ResizeImageLike<MaskImageType>(AscendingAorta, m_Working_Support, GetBackgroundValue());
75 clitk::ResizeImageLike<MaskImageType>(DescendingAorta, m_Working_Support, GetBackgroundValue());
77 // Crop superior part (when AscendingAorta and DescendingAorta join)
79 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(AscendingAorta,
80 GetBackgroundValue(), 2, false, p);
81 double max = p[2]+AscendingAorta->GetSpacing()[2];
83 clitk::CropImageRemoveGreaterThan<MaskImageType>(AscendingAorta, 2, max, false, GetBackgroundValue());
85 clitk::CropImageRemoveGreaterThan<MaskImageType>(DescendingAorta, 2, max, false, GetBackgroundValue());
87 // Crop inferior part, where LeftPulmonaryArtery start
88 MaskImagePointer AscendingAortaCopy = clitk::Clone<MaskImageType>(AscendingAorta);
89 MaskImagePointer LeftPulmonaryArtery = GetAFDB()->template GetImage<MaskImageType>("LeftPulmonaryArtery");
90 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(LeftPulmonaryArtery,
91 GetBackgroundValue(), 2, false, p);
92 max = p[2]+LeftPulmonaryArtery->GetSpacing()[2];
94 clitk::CropImageRemoveLowerThan<MaskImageType>(AscendingAorta, 2, max, false, GetBackgroundValue());
96 clitk::CropImageRemoveLowerThan<MaskImageType>(DescendingAorta, 2, max, false, GetBackgroundValue());
98 // Find closest points
99 std::vector<MaskImagePointType> A;
100 std::vector<MaskImagePointType> B;
101 clitk::SliceBySliceBuildLineSegmentAccordingToMinimalDistanceBetweenStructures<MaskImageType>(AscendingAorta,
103 GetBackgroundValue(),
105 // Separate according to AB lines
106 // clitk::WriteListOfLandmarks<MaskImageType>(A, "A.txt");
107 // clitk::WriteListOfLandmarks<MaskImageType>(B, "B.txt");
108 clitk::SliceBySliceSetBackgroundFromLineSeparation<MaskImageType>(m_Working_Support, A, B,
109 GetBackgroundValue(),
110 1, KeepPoint); // Keep point along axis 1
112 // Now, same principle between AscendingAorta and LeftPulmonaryArtery
114 clitk::ResizeImageLike<MaskImageType>(AscendingAortaCopy, m_Working_Support, GetBackgroundValue());
115 LeftPulmonaryArtery =
116 clitk::ResizeImageLike<MaskImageType>(LeftPulmonaryArtery, m_Working_Support, GetBackgroundValue());
118 clitk::CropImageRemoveGreaterThan<MaskImageType>(AscendingAorta, 2, max, false, GetBackgroundValue());
119 LeftPulmonaryArtery =
120 clitk::CropImageRemoveGreaterThan<MaskImageType>(LeftPulmonaryArtery, 2, max, false, GetBackgroundValue());
123 clitk::SliceBySliceBuildLineSegmentAccordingToMinimalDistanceBetweenStructures<MaskImageType>(AscendingAorta,
125 GetBackgroundValue(),
127 clitk::SliceBySliceSetBackgroundFromLineSeparation<MaskImageType>(m_Working_Support, A, B,
128 GetBackgroundValue(),
129 1, KeepPoint); // Keep point along axis 1
132 m_Working_Support = clitk::AutoCrop<MaskImageType>(m_Working_Support, GetBackgroundValue());
135 StopCurrentStep<MaskImageType>(m_Working_Support);
137 //--------------------------------------------------------------------