2 #include <itkBinaryDilateImageFilter.h>
3 #include <itkMirrorPadImageFilter.h>
5 //--------------------------------------------------------------------
6 template <class ImageType>
8 clitk::ExtractLymphStationsFilter<ImageType>::
9 ExtractStationSupports()
11 // Get initial Mediastinum
12 m_Working_Support = m_Mediastinum = this->GetAFDB()->template GetImage<MaskImageType>("Mediastinum", true);
14 // Consider sup/inf to Carina
15 double m_CarinaZ = FindCarina();
16 MaskImagePointer m_Support_Superior_to_Carina =
17 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
18 m_CarinaZ, true, GetBackgroundValue());
19 MaskImagePointer m_Support_Inferior_to_Carina =
20 clitk::CropImageRemoveGreaterThan<MaskImageType>(m_Working_Support, 2,
21 m_CarinaZ, true, GetBackgroundValue());
22 m_ListOfSupports["Support_Superior_to_Carina"] = m_Support_Superior_to_Carina;
23 m_ListOfSupports["Support_Inferior_to_Carina"] = m_Support_Inferior_to_Carina;
24 writeImage<MaskImageType>(m_Support_Inferior_to_Carina, "seg/Support_Inf_Carina.mha");
25 this->GetAFDB()->SetImageFilename("Support_Inf_Carina", "seg/Support_Inf_Carina.mha");
26 writeImage<MaskImageType>(m_Support_Superior_to_Carina, "seg/Support_Sup_Carina.mha");
27 this->GetAFDB()->SetImageFilename("Support_Sup_Carina", "seg/Support_Sup_Carina.mha");
30 Support_SupInf_S1RL();
31 Support_LeftRight_S1R_S1L();
34 Support_SupInf_S2R_S2L();
35 Support_LeftRight_S2R_S2L();
38 Support_SupInf_S4R_S4L();
39 Support_LeftRight_S4R_S4L();
41 // Post limits of S1,S2,S4
42 Support_Post_S1S2S4();
52 // Below Carina S7,8,9,10
53 m_ListOfSupports["S7"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
54 m_ListOfSupports["S8"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
55 m_ListOfSupports["S9"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
56 m_ListOfSupports["S10"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
57 m_ListOfSupports["S11"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
59 // Store image filenames into AFDB
60 writeImage<MaskImageType>(m_ListOfSupports["S1R"], "seg/Support_S1R.mha");
61 this->GetAFDB()->SetImageFilename("Support_S1R", "seg/Support_S1R.mha");
62 writeImage<MaskImageType>(m_ListOfSupports["S1L"], "seg/Support_S1L.mha");
63 this->GetAFDB()->SetImageFilename("Support_S1L", "seg/Support_S1L.mha");
65 writeImage<MaskImageType>(m_ListOfSupports["S2L"], "seg/Support_S2L.mha");
66 this->GetAFDB()->SetImageFilename("Support_S2L", "seg/Support_S2L.mha");
67 writeImage<MaskImageType>(m_ListOfSupports["S2R"], "seg/Support_S2R.mha");
68 this->GetAFDB()->SetImageFilename("Support_S2R", "seg/Support_S2R.mha");
70 writeImage<MaskImageType>(m_ListOfSupports["S3P"], "seg/Support_S3P.mha");
71 this->GetAFDB()->SetImageFilename("Support_S3P", "seg/Support_S3P.mha");
72 writeImage<MaskImageType>(m_ListOfSupports["S3A"], "seg/Support_S3A.mha");
73 this->GetAFDB()->SetImageFilename("Support_S3A", "seg/Support_S3A.mha");
75 writeImage<MaskImageType>(m_ListOfSupports["S4L"], "seg/Support_S4L.mha");
76 this->GetAFDB()->SetImageFilename("Support_S4L", "seg/Support_S4L.mha");
77 writeImage<MaskImageType>(m_ListOfSupports["S4R"], "seg/Support_S4R.mha");
78 this->GetAFDB()->SetImageFilename("Support_S4R", "seg/Support_S4R.mha");
80 writeImage<MaskImageType>(m_ListOfSupports["S5"], "seg/Support_S5.mha");
81 this->GetAFDB()->SetImageFilename("Support_S5", "seg/Support_S5.mha");
82 writeImage<MaskImageType>(m_ListOfSupports["S6"], "seg/Support_S6.mha");
83 this->GetAFDB()->SetImageFilename("Support_S6", "seg/Support_S6.mha");
85 writeImage<MaskImageType>(m_ListOfSupports["S7"], "seg/Support_S7.mha");
86 this->GetAFDB()->SetImageFilename("Support_S7", "seg/Support_S7.mha");
88 writeImage<MaskImageType>(m_ListOfSupports["S8"], "seg/Support_S8.mha");
89 this->GetAFDB()->SetImageFilename("Support_S8", "seg/Support_S8.mha");
91 writeImage<MaskImageType>(m_ListOfSupports["S9"], "seg/Support_S9.mha");
92 this->GetAFDB()->SetImageFilename("Support_S9", "seg/Support_S9.mha");
94 writeImage<MaskImageType>(m_ListOfSupports["S10"], "seg/Support_S10.mha");
95 this->GetAFDB()->SetImageFilename("Support_S10", "seg/Support_S10.mha");
97 writeImage<MaskImageType>(m_ListOfSupports["S11"], "seg/Support_S11.mha");
98 this->GetAFDB()->SetImageFilename("Support_S11", "seg/Support_S11.mha");
101 //--------------------------------------------------------------------
104 //--------------------------------------------------------------------
105 template <class ImageType>
107 clitk::ExtractLymphStationsFilter<ImageType>::
108 Support_SupInf_S1RL()
111 StartNewStep("[Support] Sup-Inf S1RL");
113 2R: Upper border: apex of the right lung and pleural space, and in
114 the midline, the upper border of the manubrium
116 2L: Upper border: apex of the left lung and pleural space, and in the
117 midline, the upper border of the manubrium
119 => apex / manubrium = up Sternum
121 m_Working_Support = m_ListOfSupports["Support_Superior_to_Carina"];
122 MaskImagePointer Sternum = this->GetAFDB()->template GetImage <MaskImageType>("Sternum");
123 MaskImagePointType p;
124 p[0] = p[1] = p[2] = 0.0; // to avoid warning
125 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Sternum, GetBackgroundValue(), 2, false, p);
127 p[2] += Sternum->GetSpacing()[2]; // add one slice: start just superiorly
128 MaskImagePointer S1RL =
129 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
130 p[2], true, GetBackgroundValue());
132 clitk::CropImageRemoveGreaterThan<MaskImageType>(m_Working_Support, 2,
133 p[2], true, GetBackgroundValue());
134 m_ListOfSupports["S1RL"] = S1RL;
136 //--------------------------------------------------------------------
139 //--------------------------------------------------------------------
140 template <class ImageType>
142 clitk::ExtractLymphStationsFilter<ImageType>::
143 Support_LeftRight_S1R_S1L()
145 // Step S1RL : Left-Right
146 StartNewStep("[Support] Left-Right S1R S1L");
147 std::vector<ImagePointType> A;
148 std::vector<ImagePointType> B;
149 // Search for centroid positions of trachea
150 MaskImagePointer Trachea = this->GetAFDB()->template GetImage <MaskImageType>("Trachea");
151 MaskImagePointer S1RL = m_ListOfSupports["S1RL"];
152 Trachea = clitk::ResizeImageLike<MaskImageType>(Trachea, S1RL, GetBackgroundValue());
153 std::vector<MaskSlicePointer> slices;
154 clitk::ExtractSlices<MaskImageType>(Trachea, 2, slices);
155 for(uint i=0; i<slices.size(); i++) {
156 slices[i] = Labelize<MaskSliceType>(slices[i], 0, false, 10);
157 std::vector<typename MaskSliceType::PointType> c;
158 clitk::ComputeCentroids<MaskSliceType>(slices[i], GetBackgroundValue(), c);
160 clitk::PointsUtils<MaskImageType>::Convert2DTo3D(c[1], Trachea, i, a);
166 clitk::WriteListOfLandmarks<MaskImageType>(A, "S1LR_A.txt");
167 clitk::WriteListOfLandmarks<MaskImageType>(B, "S1LR_B.txt");
170 MaskImagePointer S1R = clitk::Clone<MaskImageType>(S1RL);
171 MaskImagePointer S1L = clitk::Clone<MaskImageType>(S1RL);
174 clitk::SliceBySliceSetBackgroundFromLineSeparation<MaskImageType>(S1R, A, B,
175 GetBackgroundValue(), 0, -10);
176 S1R = clitk::AutoCrop<MaskImageType>(S1R, GetBackgroundValue());
177 m_ListOfSupports["S1R"] = S1R;
180 clitk::SliceBySliceSetBackgroundFromLineSeparation<MaskImageType>(S1L, A, B,
181 GetBackgroundValue(), 0, 10);
182 S1L = clitk::AutoCrop<MaskImageType>(S1L, GetBackgroundValue());
183 m_ListOfSupports["S1L"] = S1L;
185 //--------------------------------------------------------------------
188 //--------------------------------------------------------------------
189 template <class ImageType>
191 clitk::ExtractLymphStationsFilter<ImageType>::
192 Support_SupInf_S2R_S2L()
194 // Step : S2RL Sup-Inf limits
196 2R Lower border: intersection of caudal margin of innominate vein with
198 2L Lower border: superior border of the aortic arch
200 StartNewStep("[Support] Sup-Inf S2RL");
201 m_Working_Support = m_ListOfSupports["Support_Superior_to_Carina"];
203 // S2R Caudal Margin Of Left BrachiocephalicVein
204 MaskImagePointer BrachioCephalicVein = this->GetAFDB()->template GetImage<MaskImageType>("BrachioCephalicVein");
205 MaskImagePointType p;
206 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(BrachioCephalicVein, GetBackgroundValue(), 2, true, p);
208 // I add slightly more than a slice --> NO !!
209 double CaudalMarginOfLeftBrachiocephalicVeinZ=p[2];//+ 1.1*m_Working_Support->GetSpacing()[2];
211 this->GetAFDB()->SetDouble("CaudalMarginOfLeftBrachiocephalicVeinZ", CaudalMarginOfLeftBrachiocephalicVeinZ);
212 MaskImagePointer S2R =
213 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
214 CaudalMarginOfLeftBrachiocephalicVeinZ, true,
215 GetBackgroundValue());
216 // S2L : Top Of Aortic Arch
217 MaskImagePointer Aorta = this->GetAFDB()->template GetImage<MaskImageType>("Aorta");
218 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Aorta, GetBackgroundValue(), 2, false, p);
220 // Save the TopOfAorticArchZ
221 this->GetAFDB()->SetDouble("TopOfAorticArchZ", p[2]);
223 // I substract slightly more than a slice to respect delineation
224 double TopOfAorticArchZ=p[2]- 1.1*m_Working_Support->GetSpacing()[2];
225 // this->GetAFDB()->SetDouble("TopOfAorticArchZ", TopOfAorticArchZ);
227 MaskImagePointer S2L =
228 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
229 TopOfAorticArchZ, true,
230 GetBackgroundValue());
233 // S2RL: Superior support, I use inferior part of S1RL
234 MaskImagePointer S1L = m_ListOfSupports["S1L"];
235 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S1L, GetBackgroundValue(), 2, true, p);
238 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2L, 2,
240 GetBackgroundValue());
242 MaskImagePointer S1R = m_ListOfSupports["S1R"];
243 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S1R, GetBackgroundValue(), 2, true, p);
246 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2R, 2,
248 GetBackgroundValue());
251 // Superior limits, use Sternum (but not strictly inf to S1RL
252 MaskImagePointer Sternum = this->GetAFDB()->template GetImage <MaskImageType>("Sternum");
253 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Sternum, GetBackgroundValue(), 2, false, p);
255 p[2] = p[2] + m_Working_Support->GetSpacing()[2];
257 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2L, 2,
258 p[2], true, GetBackgroundValue());
260 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2R, 2,
261 p[2], true, GetBackgroundValue());
264 m_ListOfSupports["S2L"] = S2L;
265 m_ListOfSupports["S2R"] = S2R;
267 //--------------------------------------------------------------------
271 //--------------------------------------------------------------------
272 template <class ImageType>
274 clitk::ExtractLymphStationsFilter<ImageType>::
275 Support_LeftRight_S2R_S2L()
277 // ---------------------------------------------------------------------------
278 /* Step : S2RL LeftRight
279 As for lymph node station 4R, 2R includes nodes extending to the
280 left lateral border of the trachea
281 Rod says: "For station 2 there is a shift, dividing 2R from 2L, from midline
282 to the left paratracheal border."
284 StartNewStep("[Support] Separate 2R/2L according to Trachea");
285 MaskImagePointer S2R = m_ListOfSupports["S2R"];
286 MaskImagePointer S2L = m_ListOfSupports["S2L"];
287 S2R = LimitsWithTrachea(S2R, 0, 1, -10);
288 S2L = LimitsWithTrachea(S2L, 0, 1, 10);
289 m_ListOfSupports["S2R"] = S2R;
290 m_ListOfSupports["S2L"] = S2L;
291 this->GetAFDB()->template ReleaseImage<MaskImageType>("Trachea");
293 //--------------------------------------------------------------------
296 //--------------------------------------------------------------------
297 template <class ImageType>
299 clitk::ExtractLymphStationsFilter<ImageType>::
300 Support_SupInf_S4R_S4L()
302 // ---------------------------------------------------------------------------
303 /* Step : S4RL Sup-Inf
304 - start at the end of 2R and 2L
307 Rod says : "The inferior border is at the lower border of the azygous vein."
308 Rod says : difficulties
309 (was : "ends at the upper lobe bronchus or where the right pulmonary artery
310 crosses the midline of the mediastinum ")
312 Rod says : "The lower border is to upper margin of the left main pulmonary artery."
315 StartNewStep("[Support] Sup-Inf limits of 4R/4L");
317 // Start from the support
318 MaskImagePointer S4RL = clitk::Clone<MaskImageType>(m_Working_Support);
319 MaskImagePointer S4R = clitk::Clone<MaskImageType>(S4RL);
320 MaskImagePointer S4L = clitk::Clone<MaskImageType>(S4RL);
322 // Keep only what is lower than S2
323 MaskImagePointer S2R = m_ListOfSupports["S2R"];
324 MaskImagePointer S2L = m_ListOfSupports["S2L"];
325 MaskImagePointType p;
327 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S2R, GetBackgroundValue(),
329 S4R = clitk::CropImageRemoveGreaterThan<MaskImageType>(S4R, 2,
330 p[2], true, GetBackgroundValue());
332 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S2L, GetBackgroundValue(),
334 S4L = clitk::CropImageRemoveGreaterThan<MaskImageType>(S4L, 2,
335 p[2], true, GetBackgroundValue());
337 // Get AzygousVein and limit according to LowerBorderAzygousVein
338 MaskImagePointer LowerBorderAzygousVein
339 = this->GetAFDB()->template GetImage<MaskImageType>("LowerBorderAzygousVein");
340 std::vector<MaskImagePointType> c;
341 clitk::ComputeCentroids<MaskImageType>(LowerBorderAzygousVein, GetBackgroundValue(), c);
342 S4R = clitk::CropImageRemoveLowerThan<MaskImageType>(S4R, 2,
343 c[1][2], true, GetBackgroundValue());
344 S4R = clitk::AutoCrop<MaskImageType>(S4R, GetBackgroundValue());
345 m_ListOfSupports["S4R"] = S4R;
348 // Limit according to LeftPulmonaryArtery
349 MaskImagePointer LeftPulmonaryArtery
350 = this->GetAFDB()->template GetImage<MaskImageType>("LeftPulmonaryArtery");
351 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(LeftPulmonaryArtery, GetBackgroundValue(),
353 S4L = clitk::CropImageRemoveLowerThan<MaskImageType>(S4L, 2,
354 p[2], true, GetBackgroundValue());
355 S4L = clitk::AutoCrop<MaskImageType>(S4L, GetBackgroundValue());
356 m_ListOfSupports["S4L"] = S4L;
358 //--------------------------------------------------------------------
361 //--------------------------------------------------------------------
362 template <class ImageType>
364 clitk::ExtractLymphStationsFilter<ImageType>::
365 Support_LeftRight_S4R_S4L()
367 // ---------------------------------------------------------------------------
368 /* Step : S4RL LeftRight
370 - 4R: includes right paratracheal nodes, and pretracheal nodes
371 extending to the left lateral border of trachea
373 - 4L: includes nodes to the left of the left lateral border of
374 the trachea, medial to the ligamentum arteriosum
378 StartNewStep("[Support] Left Right separation of 4R/4L");
380 MaskImagePointer S4R = m_ListOfSupports["S4R"];
381 MaskImagePointer S4L = m_ListOfSupports["S4L"];
382 S4R = LimitsWithTrachea(S4R, 0, 1, -10);
383 S4L = LimitsWithTrachea(S4L, 0, 1, 10);
384 m_ListOfSupports["S4R"] = S4R;
385 m_ListOfSupports["S4L"] = S4L;
387 //--------------------------------------------------------------------
390 //--------------------------------------------------------------------
391 template <class ImageType>
392 typename clitk::ExtractLymphStationsFilter<ImageType>::MaskImagePointer
393 clitk::ExtractLymphStationsFilter<ImageType>::
394 LimitsWithTrachea(MaskImageType * input, int extremaDirection, int lineDirection,
397 MaskImagePointType min, max;
398 GetMinMaxBoundary<MaskImageType>(input, min, max);
399 return LimitsWithTrachea(input, extremaDirection, lineDirection, offset, max[2]);
401 template <class ImageType>
402 typename clitk::ExtractLymphStationsFilter<ImageType>::MaskImagePointer
403 clitk::ExtractLymphStationsFilter<ImageType>::
404 LimitsWithTrachea(MaskImageType * input, int extremaDirection, int lineDirection,
405 double offset, double maxSupPosition)
408 Take the input mask, consider the trachea and limit according to
409 Left border of the trachea. Keep at Left or at Right according to
413 MaskImagePointer Trachea = this->GetAFDB()->template GetImage<MaskImageType>("Trachea");
415 // Find extrema post positions
416 std::vector<MaskImagePointType> tracheaLeftPositionsA;
417 std::vector<MaskImagePointType> tracheaLeftPositionsB;
419 // Crop Trachea only on the Sup-Inf axes, without autocrop
420 // Trachea = clitk::ResizeImageLike<MaskImageType>(Trachea, input, GetBackgroundValue());
421 MaskImagePointType min, max;
422 GetMinMaxBoundary<MaskImageType>(input, min, max);
423 Trachea = clitk::CropImageAlongOneAxis<MaskImageType>(Trachea, 2, min[2], max[2],
424 false, GetBackgroundValue());
426 // Select the main CCL (because of bronchus)
427 Trachea = SliceBySliceKeepMainCCL<MaskImageType>(Trachea, GetBackgroundValue(), GetForegroundValue());
429 // Slice by slice, build the separation line
430 clitk::SliceBySliceBuildLineSegmentAccordingToExtremaPosition<MaskImageType>(Trachea,
431 GetBackgroundValue(), 2,
432 extremaDirection, false, // Left
433 lineDirection, // Vertical line
435 tracheaLeftPositionsA,
436 tracheaLeftPositionsB);
437 // Do not consider trachea above the limit
438 int indexMax=tracheaLeftPositionsA.size();
439 for(uint i=0; i<tracheaLeftPositionsA.size(); i++) {
440 if (tracheaLeftPositionsA[i][2] > maxSupPosition) {
442 i = tracheaLeftPositionsA.size(); // stop loop
445 tracheaLeftPositionsA.erase(tracheaLeftPositionsA.begin()+indexMax, tracheaLeftPositionsA.end());
446 tracheaLeftPositionsB.erase(tracheaLeftPositionsB.begin()+indexMax, tracheaLeftPositionsB.end());
448 // Cut post to this line
449 clitk::SliceBySliceSetBackgroundFromLineSeparation<MaskImageType>(input,
450 tracheaLeftPositionsA,
451 tracheaLeftPositionsB,
452 GetBackgroundValue(),
453 extremaDirection, offset);
454 MaskImagePointer output = clitk::AutoCrop<MaskImageType>(input, GetBackgroundValue());
457 //--------------------------------------------------------------------
460 //--------------------------------------------------------------------
461 template <class ImageType>
463 clitk::ExtractLymphStationsFilter<ImageType>::
464 Support_Post_S1S2S4()
466 StartNewStep("[Support] Post limits of S1RL, S2RL, S4RL");
468 double m_ApexOfTheChest = FindApexOfTheChest();
470 // Post limits with Trachea
471 MaskImagePointer S1R = m_ListOfSupports["S1R"];
472 MaskImagePointer S1L = m_ListOfSupports["S1L"];
473 MaskImagePointer S2R = m_ListOfSupports["S2R"];
474 MaskImagePointer S2L = m_ListOfSupports["S2L"];
475 MaskImagePointer S4R = m_ListOfSupports["S4R"];
476 MaskImagePointer S4L = m_ListOfSupports["S4L"];
477 S1L = LimitsWithTrachea(S1L, 1, 0, -10, m_ApexOfTheChest);
478 S1R = LimitsWithTrachea(S1R, 1, 0, -10, m_ApexOfTheChest);
479 S2R = LimitsWithTrachea(S2R, 1, 0, -10, m_ApexOfTheChest);
480 S2L = LimitsWithTrachea(S2L, 1, 0, -10, m_ApexOfTheChest);
481 S4R = LimitsWithTrachea(S4R, 1, 0, -10, m_ApexOfTheChest);
482 S4L = LimitsWithTrachea(S4L, 1, 0, -10, m_ApexOfTheChest);
484 //--------------------------------------------------------------------
487 //--------------------------------------------------------------------
488 template <class ImageType>
490 clitk::ExtractLymphStationsFilter<ImageType>::
493 StartNewStep("[Support] Ant limits of S3P and Post limits of S1RL, S2RL, S4RL");
495 // Initial S3P support
496 MaskImagePointer S3P = clitk::Clone<MaskImageType>(m_ListOfSupports["Support_Superior_to_Carina"]);
499 double m_ApexOfTheChest = FindApexOfTheChest();
501 clitk::CropImageRemoveGreaterThan<MaskImageType>(S3P, 2,
502 m_ApexOfTheChest, true,
503 GetBackgroundValue());
504 // Ant limits with Trachea
505 S3P = LimitsWithTrachea(S3P, 1, 0, 10);
506 m_ListOfSupports["S3P"] = S3P;
508 //--------------------------------------------------------------------
511 //--------------------------------------------------------------------
512 template <class ImageType>
514 clitk::ExtractLymphStationsFilter<ImageType>::
517 StartNewStep("[Support] Sup-Inf and Post limits for S3A");
519 // Initial S3A support
520 MaskImagePointer S3A = clitk::Clone<MaskImageType>(m_ListOfSupports["Support_Superior_to_Carina"]);
522 // Stop at Lung Apex or like S2/S1 (upper border Sternum - manubrium) ?
524 //double m_ApexOfTheChest = FindApexOfTheChest();
526 MaskImagePointer Sternum = this->GetAFDB()->template GetImage <MaskImageType>("Sternum");
527 MaskImagePointType p;
528 p[0] = p[1] = p[2] = 0.0; // to avoid warning
529 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Sternum, GetBackgroundValue(), 2, false, p);
530 p[2] += Sternum->GetSpacing()[2]; // we add one slice to stop 3A at the same slice than Sternum stop
532 clitk::CropImageRemoveGreaterThan<MaskImageType>(S3A, 2,
535 GetBackgroundValue());
536 // Ant limits with Trachea
537 S3A = LimitsWithTrachea(S3A, 1, 0, -10);
538 m_ListOfSupports["S3A"] = S3A;
540 //--------------------------------------------------------------------
543 //--------------------------------------------------------------------
544 template <class ImageType>
546 clitk::ExtractLymphStationsFilter<ImageType>::
549 StartNewStep("[Support] Sup-Inf limits S5 with Aorta and MainPulmonaryArtery");
551 // Initial S5 support
552 MaskImagePointer S5 =
553 clitk::Clone<MaskImageType>(this->GetAFDB()->template GetImage<MaskImageType>("Mediastinum", true));
555 // Sup limits with Aorta
556 double sup = FindInferiorBorderOfAorticArch();
558 // Inf limits with "upper rim of the left main pulmonary artery"
559 // For the moment only, it will change.
560 MaskImagePointer MainPulmonaryArtery = this->GetAFDB()->template GetImage<MaskImageType>("MainPulmonaryArtery");
561 MaskImagePointType p;
562 p[0] = p[1] = p[2] = 0.0; // to avoid warning
563 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(MainPulmonaryArtery, GetBackgroundValue(), 2, false, p);
564 p[2] += MainPulmonaryArtery->GetSpacing()[2];
567 S5 = clitk::CropImageAlongOneAxis<MaskImageType>(S5, 2, p[2], sup, true, GetBackgroundValue());
569 m_ListOfSupports["S5"] = S5;
571 //--------------------------------------------------------------------
573 //--------------------------------------------------------------------
574 template <class ImageType>
576 clitk::ExtractLymphStationsFilter<ImageType>::
579 StartNewStep("[Support] Sup-Inf limits S6 with aorta");
581 // Initial S6 support like S3A
582 MaskImagePointer S6 = clitk::Clone<MaskImageType>(m_ListOfSupports["S3A"]);
584 // Inf Sup limits with Aorta
585 double sup = FindSuperiorBorderOfAorticArch();
586 double inf = FindInferiorBorderOfAorticArch();
589 S6 = clitk::CropImageAlongOneAxis<MaskImageType>(S6, 2, inf, sup, true, GetBackgroundValue());
591 m_ListOfSupports["S6"] = S6;
593 //--------------------------------------------------------------------