2 #include <itkBinaryDilateImageFilter.h>
3 #include <itkMirrorPadImageFilter.h>
5 //--------------------------------------------------------------------
6 template <class ImageType>
8 clitk::ExtractLymphStationsFilter<ImageType>::
9 ExtractStationSupports()
11 DD("ExtractStationSupports");
13 // Get initial Mediastinum
14 m_Working_Support = m_Mediastinum = this->GetAFDB()->template GetImage<MaskImageType>("Mediastinum", true);
16 // Consider sup/inf to Carina
17 double m_CarinaZ = FindCarina();
18 MaskImagePointer m_Support_Superior_to_Carina =
19 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
20 m_CarinaZ, true, GetBackgroundValue());
21 MaskImagePointer m_Support_Inferior_to_Carina =
22 clitk::CropImageRemoveGreaterThan<MaskImageType>(m_Working_Support, 2,
23 m_CarinaZ, true, GetBackgroundValue());
24 m_ListOfSupports["Support_Superior_to_Carina"] = m_Support_Superior_to_Carina;
25 m_ListOfSupports["Support_Inferior_to_Carina"] = m_Support_Inferior_to_Carina;
26 writeImage<MaskImageType>(m_Support_Inferior_to_Carina, "seg/Support_Inf_Carina.mhd");
27 this->GetAFDB()->SetImageFilename("Support_Inf_Carina", "seg/Support_Inf_Carina.mhd");
28 writeImage<MaskImageType>(m_Support_Superior_to_Carina, "seg/Support_Sup_Carina.mhd");
29 this->GetAFDB()->SetImageFilename("Support_Sup_Carina", "seg/Support_Sup_Carina.mhd");
32 Support_SupInf_S1RL();
33 Support_LeftRight_S1R_S1L();
36 Support_SupInf_S2R_S2L();
37 Support_LeftRight_S2R_S2L();
40 Support_SupInf_S4R_S4L();
41 Support_LeftRight_S4R_S4L();
43 // Post limits of S1,S2,S4
44 Support_Post_S1S2S4();
54 // Below Carina S7,8,9,10
55 m_ListOfSupports["S7"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
56 m_ListOfSupports["S8"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
57 m_ListOfSupports["S9"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
58 m_ListOfSupports["S10"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
59 m_ListOfSupports["S11"] = clitk::Clone<MaskImageType>(m_Support_Inferior_to_Carina);
61 // Store image filenames into AFDB
62 writeImage<MaskImageType>(m_ListOfSupports["S1R"], "seg/Support_S1R.mhd");
63 this->GetAFDB()->SetImageFilename("Support_S1R", "seg/Support_S1R.mhd");
64 writeImage<MaskImageType>(m_ListOfSupports["S1L"], "seg/Support_S1L.mhd");
65 this->GetAFDB()->SetImageFilename("Support_S1L", "seg/Support_S1L.mhd");
67 writeImage<MaskImageType>(m_ListOfSupports["S2L"], "seg/Support_S2L.mhd");
68 this->GetAFDB()->SetImageFilename("Support_S2L", "seg/Support_S2L.mhd");
69 writeImage<MaskImageType>(m_ListOfSupports["S2R"], "seg/Support_S2R.mhd");
70 this->GetAFDB()->SetImageFilename("Support_S2R", "seg/Support_S2R.mhd");
72 writeImage<MaskImageType>(m_ListOfSupports["S3P"], "seg/Support_S3P.mhd");
73 this->GetAFDB()->SetImageFilename("Support_S3P", "seg/Support_S3P.mhd");
74 writeImage<MaskImageType>(m_ListOfSupports["S3A"], "seg/Support_S3A.mhd");
75 this->GetAFDB()->SetImageFilename("Support_S3A", "seg/Support_S3A.mhd");
77 writeImage<MaskImageType>(m_ListOfSupports["S4L"], "seg/Support_S4L.mhd");
78 this->GetAFDB()->SetImageFilename("Support_S4L", "seg/Support_S4L.mhd");
79 writeImage<MaskImageType>(m_ListOfSupports["S4R"], "seg/Support_S4R.mhd");
80 this->GetAFDB()->SetImageFilename("Support_S4R", "seg/Support_S4R.mhd");
82 writeImage<MaskImageType>(m_ListOfSupports["S5"], "seg/Support_S5.mhd");
83 this->GetAFDB()->SetImageFilename("Support_S5", "seg/Support_S5.mhd");
84 writeImage<MaskImageType>(m_ListOfSupports["S6"], "seg/Support_S6.mhd");
85 this->GetAFDB()->SetImageFilename("Support_S6", "seg/Support_S6.mhd");
87 writeImage<MaskImageType>(m_ListOfSupports["S7"], "seg/Support_S7.mhd");
88 this->GetAFDB()->SetImageFilename("Support_S7", "seg/Support_S7.mhd");
90 writeImage<MaskImageType>(m_ListOfSupports["S8"], "seg/Support_S8.mhd");
91 this->GetAFDB()->SetImageFilename("Support_S8", "seg/Support_S8.mhd");
93 writeImage<MaskImageType>(m_ListOfSupports["S9"], "seg/Support_S9.mhd");
94 this->GetAFDB()->SetImageFilename("Support_S9", "seg/Support_S9.mhd");
96 writeImage<MaskImageType>(m_ListOfSupports["S10"], "seg/Support_S10.mhd");
97 this->GetAFDB()->SetImageFilename("Support_S10", "seg/Support_S10.mhd");
99 writeImage<MaskImageType>(m_ListOfSupports["S11"], "seg/Support_S11.mhd");
100 this->GetAFDB()->SetImageFilename("Support_S11", "seg/Support_S11.mhd");
103 //--------------------------------------------------------------------
106 //--------------------------------------------------------------------
107 template <class ImageType>
109 clitk::ExtractLymphStationsFilter<ImageType>::
110 Support_SupInf_S1RL()
113 StartNewStep("[Support] Sup-Inf S1RL");
115 2R: Upper border: apex of the right lung and pleural space, and in
116 the midline, the upper border of the manubrium
118 2L: Upper border: apex of the left lung and pleural space, and in the
119 midline, the upper border of the manubrium
121 => apex / manubrium = up Sternum
123 m_Working_Support = m_ListOfSupports["Support_Superior_to_Carina"];
124 MaskImagePointer Sternum = this->GetAFDB()->template GetImage <MaskImageType>("Sternum");
125 MaskImagePointType p;
126 p[0] = p[1] = p[2] = 0.0; // to avoid warning
127 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Sternum, GetBackgroundValue(), 2, false, p);
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);
207 // I add slightly more than a slice
208 double CaudalMarginOfLeftBrachiocephalicVeinZ=p[2]+ 1.1*m_Working_Support->GetSpacing()[2];
209 this->GetAFDB()->SetDouble("CaudalMarginOfLeftBrachiocephalicVeinZ", CaudalMarginOfLeftBrachiocephalicVeinZ);
210 MaskImagePointer S2R =
211 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
212 CaudalMarginOfLeftBrachiocephalicVeinZ, true,
213 GetBackgroundValue());
214 // S2L : Top Of Aortic Arch
215 MaskImagePointer Aorta = this->GetAFDB()->template GetImage<MaskImageType>("Aorta");
216 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Aorta, GetBackgroundValue(), 2, false, p);
218 // Save the TopOfAorticArchZ
219 this->GetAFDB()->SetDouble("TopOfAorticArchZ", p[2]);
221 // I substract slightly more than a slice to respect delineation
222 double TopOfAorticArchZ=p[2]- 1.1*m_Working_Support->GetSpacing()[2];
223 // this->GetAFDB()->SetDouble("TopOfAorticArchZ", TopOfAorticArchZ);
225 MaskImagePointer S2L =
226 clitk::CropImageRemoveLowerThan<MaskImageType>(m_Working_Support, 2,
227 TopOfAorticArchZ, true,
228 GetBackgroundValue());
231 // S2RL: Superior support, I use inferior part of S1RL
232 MaskImagePointer S1L = m_ListOfSupports["S1L"];
233 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S1L, GetBackgroundValue(), 2, true, p);
236 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2L, 2,
238 GetBackgroundValue());
240 MaskImagePointer S1R = m_ListOfSupports["S1R"];
241 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S1R, GetBackgroundValue(), 2, true, p);
244 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2R, 2,
246 GetBackgroundValue());
249 // Superior limits, use Sternum (but not strictly inf to S1RL
250 MaskImagePointer Sternum = this->GetAFDB()->template GetImage <MaskImageType>("Sternum");
251 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Sternum, GetBackgroundValue(), 2, false, p);
253 p[2] = p[2] + m_Working_Support->GetSpacing()[2];
255 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2L, 2,
256 p[2], true, GetBackgroundValue());
258 clitk::CropImageRemoveGreaterThan<MaskImageType>(S2R, 2,
259 p[2], true, GetBackgroundValue());
262 m_ListOfSupports["S2L"] = S2L;
263 m_ListOfSupports["S2R"] = S2R;
265 //--------------------------------------------------------------------
269 //--------------------------------------------------------------------
270 template <class ImageType>
272 clitk::ExtractLymphStationsFilter<ImageType>::
273 Support_LeftRight_S2R_S2L()
275 // ---------------------------------------------------------------------------
276 /* Step : S2RL LeftRight
277 As for lymph node station 4R, 2R includes nodes extending to the
278 left lateral border of the trachea
279 Rod says: "For station 2 there is a shift, dividing 2R from 2L, from midline
280 to the left paratracheal border."
282 StartNewStep("[Support] Separate 2R/2L according to Trachea");
283 MaskImagePointer S2R = m_ListOfSupports["S2R"];
284 MaskImagePointer S2L = m_ListOfSupports["S2L"];
285 S2R = LimitsWithTrachea(S2R, 0, 1, -10);
286 S2L = LimitsWithTrachea(S2L, 0, 1, 10);
287 m_ListOfSupports["S2R"] = S2R;
288 m_ListOfSupports["S2L"] = S2L;
289 this->GetAFDB()->template ReleaseImage<MaskImageType>("Trachea");
291 //--------------------------------------------------------------------
294 //--------------------------------------------------------------------
295 template <class ImageType>
297 clitk::ExtractLymphStationsFilter<ImageType>::
298 Support_SupInf_S4R_S4L()
300 // ---------------------------------------------------------------------------
301 /* Step : S4RL Sup-Inf
302 - start at the end of 2R and 2L
305 Rod says : "The inferior border is at the lower border of the azygous vein."
306 Rod says : difficulties
307 (was : "ends at the upper lobe bronchus or where the right pulmonary artery
308 crosses the midline of the mediastinum ")
310 Rod says : "The lower border is to upper margin of the left main pulmonary artery."
313 StartNewStep("[Support] Sup-Inf limits of 4R/4L");
315 // Start from the support
316 MaskImagePointer S4RL = clitk::Clone<MaskImageType>(m_Working_Support);
317 MaskImagePointer S4R = clitk::Clone<MaskImageType>(S4RL);
318 MaskImagePointer S4L = clitk::Clone<MaskImageType>(S4RL);
320 // Keep only what is lower than S2
321 MaskImagePointer S2R = m_ListOfSupports["S2R"];
322 MaskImagePointer S2L = m_ListOfSupports["S2L"];
323 MaskImagePointType p;
325 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S2R, GetBackgroundValue(),
328 writeImage<MaskImageType>(S4R, "before.mha");
329 S4R = clitk::CropImageRemoveGreaterThan<MaskImageType>(S4R, 2,
330 p[2], true, GetBackgroundValue());
331 writeImage<MaskImageType>(S4R, "after.mha");
334 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(S2L, GetBackgroundValue(),
337 S4L = clitk::CropImageRemoveGreaterThan<MaskImageType>(S4L, 2,
338 p[2], true, GetBackgroundValue());
339 // S4R = clitk::AutoCrop<MaskImageType>(S4R, GetBackgroundValue());
340 // S4L = clitk::AutoCrop<MaskImageType>(S4L, GetBackgroundValue());
342 // Get AzygousVein and limit according to LowerBorderAzygousVein
343 MaskImagePointer LowerBorderAzygousVein
344 = this->GetAFDB()->template GetImage<MaskImageType>("LowerBorderAzygousVein");
345 std::vector<MaskImagePointType> c;
346 clitk::ComputeCentroids<MaskImageType>(LowerBorderAzygousVein, GetBackgroundValue(), c);
347 S4R = clitk::CropImageRemoveLowerThan<MaskImageType>(S4R, 2,
348 c[1][2], true, GetBackgroundValue());
349 S4R = clitk::AutoCrop<MaskImageType>(S4R, GetBackgroundValue());
350 m_ListOfSupports["S4R"] = S4R;
353 // Limit according to LeftPulmonaryArtery
354 MaskImagePointer LeftPulmonaryArtery
355 = this->GetAFDB()->template GetImage<MaskImageType>("LeftPulmonaryArtery");
356 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(LeftPulmonaryArtery, GetBackgroundValue(),
358 S4L = clitk::CropImageRemoveLowerThan<MaskImageType>(S4L, 2,
359 p[2], true, GetBackgroundValue());
360 S4L = clitk::AutoCrop<MaskImageType>(S4L, GetBackgroundValue());
361 m_ListOfSupports["S4L"] = S4L;
363 //--------------------------------------------------------------------
366 //--------------------------------------------------------------------
367 template <class ImageType>
369 clitk::ExtractLymphStationsFilter<ImageType>::
370 Support_LeftRight_S4R_S4L()
372 // ---------------------------------------------------------------------------
373 /* Step : S4RL LeftRight
375 - 4R: includes right paratracheal nodes, and pretracheal nodes
376 extending to the left lateral border of trachea
378 - 4L: includes nodes to the left of the left lateral border of
379 the trachea, medial to the ligamentum arteriosum
383 StartNewStep("[Support] Left Right separation of 4R/4L");
385 MaskImagePointer S4R = m_ListOfSupports["S4R"];
386 MaskImagePointer S4L = m_ListOfSupports["S4L"];
387 S4R = LimitsWithTrachea(S4R, 0, 1, -10);
388 S4L = LimitsWithTrachea(S4L, 0, 1, 10);
389 m_ListOfSupports["S4R"] = S4R;
390 m_ListOfSupports["S4L"] = S4L;
392 //--------------------------------------------------------------------
395 //--------------------------------------------------------------------
396 template <class ImageType>
397 typename clitk::ExtractLymphStationsFilter<ImageType>::MaskImagePointer
398 clitk::ExtractLymphStationsFilter<ImageType>::
399 LimitsWithTrachea(MaskImageType * input, int extremaDirection, int lineDirection,
402 MaskImagePointType min, max;
403 GetMinMaxBoundary<MaskImageType>(input, min, max);
404 return LimitsWithTrachea(input, extremaDirection, lineDirection, offset, max[2]);
406 template <class ImageType>
407 typename clitk::ExtractLymphStationsFilter<ImageType>::MaskImagePointer
408 clitk::ExtractLymphStationsFilter<ImageType>::
409 LimitsWithTrachea(MaskImageType * input, int extremaDirection, int lineDirection,
410 double offset, double maxSupPosition)
413 Take the input mask, consider the trachea and limit according to
414 Left border of the trachea. Keep at Left or at Right according to
418 MaskImagePointer Trachea = this->GetAFDB()->template GetImage<MaskImageType>("Trachea");
420 // Find extrema post positions
421 std::vector<MaskImagePointType> tracheaLeftPositionsA;
422 std::vector<MaskImagePointType> tracheaLeftPositionsB;
424 // Crop Trachea only on the Sup-Inf axes, without autocrop
425 // Trachea = clitk::ResizeImageLike<MaskImageType>(Trachea, input, GetBackgroundValue());
426 MaskImagePointType min, max;
427 GetMinMaxBoundary<MaskImageType>(input, min, max);
428 Trachea = clitk::CropImageAlongOneAxis<MaskImageType>(Trachea, 2, min[2], max[2],
429 false, GetBackgroundValue());
431 // Select the main CCL (because of bronchus)
432 Trachea = SliceBySliceKeepMainCCL<MaskImageType>(Trachea, GetBackgroundValue(), GetForegroundValue());
434 // Slice by slice, build the separation line
435 clitk::SliceBySliceBuildLineSegmentAccordingToExtremaPosition<MaskImageType>(Trachea,
436 GetBackgroundValue(), 2,
437 extremaDirection, false, // Left
438 lineDirection, // Vertical line
440 tracheaLeftPositionsA,
441 tracheaLeftPositionsB);
442 // Do not consider trachea above the limit
443 int indexMax=tracheaLeftPositionsA.size();
444 for(uint i=0; i<tracheaLeftPositionsA.size(); i++) {
445 if (tracheaLeftPositionsA[i][2] > maxSupPosition) {
447 i = tracheaLeftPositionsA.size(); // stop loop
450 tracheaLeftPositionsA.erase(tracheaLeftPositionsA.begin()+indexMax, tracheaLeftPositionsA.end());
451 tracheaLeftPositionsB.erase(tracheaLeftPositionsB.begin()+indexMax, tracheaLeftPositionsB.end());
453 // Cut post to this line
454 clitk::SliceBySliceSetBackgroundFromLineSeparation<MaskImageType>(input,
455 tracheaLeftPositionsA,
456 tracheaLeftPositionsB,
457 GetBackgroundValue(),
458 extremaDirection, offset);
459 MaskImagePointer output = clitk::AutoCrop<MaskImageType>(input, GetBackgroundValue());
462 //--------------------------------------------------------------------
465 //--------------------------------------------------------------------
466 template <class ImageType>
468 clitk::ExtractLymphStationsFilter<ImageType>::
469 Support_Post_S1S2S4()
471 StartNewStep("[Support] Post limits of S1RL, S2RL, S4RL");
473 double m_ApexOfTheChest = FindApexOfTheChest();
475 // Post limits with Trachea
476 MaskImagePointer S1R = m_ListOfSupports["S1R"];
477 MaskImagePointer S1L = m_ListOfSupports["S1L"];
478 MaskImagePointer S2R = m_ListOfSupports["S2R"];
479 MaskImagePointer S2L = m_ListOfSupports["S2L"];
480 MaskImagePointer S4R = m_ListOfSupports["S4R"];
481 MaskImagePointer S4L = m_ListOfSupports["S4L"];
482 S1L = LimitsWithTrachea(S1L, 1, 0, -10, m_ApexOfTheChest);
483 S1R = LimitsWithTrachea(S1R, 1, 0, -10, m_ApexOfTheChest);
484 S2R = LimitsWithTrachea(S2R, 1, 0, -10, m_ApexOfTheChest);
485 S2L = LimitsWithTrachea(S2L, 1, 0, -10, m_ApexOfTheChest);
486 S4R = LimitsWithTrachea(S4R, 1, 0, -10, m_ApexOfTheChest);
487 S4L = LimitsWithTrachea(S4L, 1, 0, -10, m_ApexOfTheChest);
489 //--------------------------------------------------------------------
492 //--------------------------------------------------------------------
493 template <class ImageType>
495 clitk::ExtractLymphStationsFilter<ImageType>::
498 StartNewStep("[Support] Ant limits of S3P and Post limits of S1RL, S2RL, S4RL");
500 // Initial S3P support
501 MaskImagePointer S3P = clitk::Clone<MaskImageType>(m_ListOfSupports["Support_Superior_to_Carina"]);
504 double m_ApexOfTheChest = FindApexOfTheChest();
506 clitk::CropImageRemoveGreaterThan<MaskImageType>(S3P, 2,
507 m_ApexOfTheChest, true,
508 GetBackgroundValue());
509 // Ant limits with Trachea
510 S3P = LimitsWithTrachea(S3P, 1, 0, 10);
511 m_ListOfSupports["S3P"] = S3P;
513 //--------------------------------------------------------------------
516 //--------------------------------------------------------------------
517 template <class ImageType>
519 clitk::ExtractLymphStationsFilter<ImageType>::
522 StartNewStep("[Support] Sup-Inf and Post limits for S3A");
524 // Initial S3A support
525 MaskImagePointer S3A = clitk::Clone<MaskImageType>(m_ListOfSupports["Support_Superior_to_Carina"]);
527 // Stop at Lung Apex or like S2/S1 (upper border Sternum - manubrium) ?
529 //double m_ApexOfTheChest = FindApexOfTheChest();
531 MaskImagePointer Sternum = this->GetAFDB()->template GetImage <MaskImageType>("Sternum");
532 MaskImagePointType p;
533 p[0] = p[1] = p[2] = 0.0; // to avoid warning
534 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(Sternum, GetBackgroundValue(), 2, false, p);
537 clitk::CropImageRemoveGreaterThan<MaskImageType>(S3A, 2,
540 GetBackgroundValue());
541 // Ant limits with Trachea
542 S3A = LimitsWithTrachea(S3A, 1, 0, -10);
543 m_ListOfSupports["S3A"] = S3A;
545 //--------------------------------------------------------------------
548 //--------------------------------------------------------------------
549 template <class ImageType>
551 clitk::ExtractLymphStationsFilter<ImageType>::
554 StartNewStep("[Support] Sup-Inf limits S5 with aorta");
556 // Initial S5 support
557 MaskImagePointer S5 =
558 clitk::Clone<MaskImageType>(this->GetAFDB()->template GetImage<MaskImageType>("Mediastinum", true));
560 // Sup limits with Aorta
561 double sup = FindInferiorBorderOfAorticArch();
563 // Inf limits with "upper rim of the left main pulmonary artery"
564 // For the moment only, it will change.
565 MaskImagePointer PulmonaryTrunk = this->GetAFDB()->template GetImage<MaskImageType>("PulmonaryTrunk");
566 MaskImagePointType p;
567 p[0] = p[1] = p[2] = 0.0; // to avoid warning
568 clitk::FindExtremaPointInAGivenDirection<MaskImageType>(PulmonaryTrunk, GetBackgroundValue(), 2, false, p);
569 p[2] += PulmonaryTrunk->GetSpacing()[2];
573 S5 = clitk::CropImageAlongOneAxis<MaskImageType>(S5, 2, p[2], sup, true, GetBackgroundValue());
575 m_ListOfSupports["S5"] = S5;
577 //--------------------------------------------------------------------
579 //--------------------------------------------------------------------
580 template <class ImageType>
582 clitk::ExtractLymphStationsFilter<ImageType>::
585 StartNewStep("[Support] Sup-Inf limits S6 with aorta");
587 // Initial S6 support like S3A
588 MaskImagePointer S6 = clitk::Clone<MaskImageType>(m_ListOfSupports["S3A"]);
590 // Inf Sup limits with Aorta
591 double sup = FindSuperiorBorderOfAorticArch();
592 double inf = FindInferiorBorderOfAorticArch();
595 S6 = clitk::CropImageAlongOneAxis<MaskImageType>(S6, 2, inf, sup, true, GetBackgroundValue());
597 m_ListOfSupports["S6"] = S6;
599 //--------------------------------------------------------------------