1 //--------------------------------------------------------------------
2 template <class TImageType>
4 clitk::ExtractLymphStationsFilter<TImageType>::
5 ExtractStation_4RL_SI_Limits()
9 - ends at the upper lobe bronchus or where the right pulmonary artery crosses the midline of the mediastinum
13 double m_TopOfAorticArchInMM;
14 double m_UpperLobeBronchusZPositionInMM;
15 double m_RightPulmoArteyrCrossesMidMediastinumZPositionInMM;
18 m_TopOfAorticArchInMM = GetAFDB()->GetPoint3D("topOfAorticArch", 2);
19 DD(m_TopOfAorticArchInMM);
20 m_UpperLobeBronchusZPositionInMM = GetAFDB()->GetPoint3D("rightUpperLobeBronchus", 2);
21 DD(m_UpperLobeBronchusZPositionInMM);
22 m_RightPulmoArteyrCrossesMidMediastinumZPositionInMM = GetAFDB()->GetPoint3D("rightPulmoArteryCrossesMidMediastinum", 2);
23 DD(m_RightPulmoArteyrCrossesMidMediastinumZPositionInMM);
26 StartNewStep("Inf/Sup mediastinum limits with aortic arch/upperLBronchus");
27 double inf = std::max(m_UpperLobeBronchusZPositionInMM, m_RightPulmoArteyrCrossesMidMediastinumZPositionInMM);
29 clitk::CropImageAlongOneAxis<MaskImageType>(m_Support, 2,
31 m_TopOfAorticArchInMM, true,
32 GetBackgroundValue());
33 StopCurrentStep<MaskImageType>(m_Working_Support);
35 m_Station4RL = m_Working_Support;
37 //--------------------------------------------------------------------
40 //--------------------------------------------------------------------
41 template <class TImageType>
43 clitk::ExtractLymphStationsFilter<TImageType>::
44 ExtractStation_4RL_LR_Limits()
48 // Left : midline of the trachea
49 // Right : "- upper part : contained within the pleural envelope
50 //- intermediate section : medial to the superior vena cava and the arch of the azygos vein
51 // - very caudal part : right upper lobe pulmonary vein"
54 // Constraint at right from the SVC
55 MaskImagePointer svc = GetAFDB()->template GetImage<MaskImageType>("SVC");
56 typedef clitk::AddRelativePositionConstraintToLabelImageFilter<MaskImageType> RelPosFilterType;
57 typename RelPosFilterType::Pointer relPosFilter = RelPosFilterType::New();
58 relPosFilter->SetCurrentStepBaseId(this->GetCurrentStepId());
59 relPosFilter->VerboseStepOff();
60 relPosFilter->WriteStepOff();
61 relPosFilter->SetInput(m_Working_Support);
62 relPosFilter->SetInputObject(svc);
63 relPosFilter->SetOrientationType(RelPosFilterType::RightTo);
64 relPosFilter->SetIntermediateSpacing(2);
65 relPosFilter->SetFuzzyThreshold(0.3);
66 relPosFilter->Update();
67 m_Working_Support = relPosFilter->GetOutput();
68 m_Station4RL = m_Working_Support;
70 // Left -> midline of the trachea
71 // slice by slice, find X coord of 2D centroid (?)
72 // check with previous line in order to not move too fast
74 // skeleton ? -> need path description ? follow from slice to slice
75 // OR CENTROID at each slice ?
78 // Extract list of slice from trachea
79 // Loop slice -> Get centroid crop along line (BB limit) -> two supports
81 // Crop the trachea like the current support
82 MaskImagePointer crop_trachea =
83 clitk::ResizeImageLike<MaskImageType>(m_Trachea, m_Working_Support, GetBackgroundValue());
84 writeImage<MaskImageType>(crop_trachea, "croptrachea.mhd");
86 // Extract all the slices
87 typedef clitk::ExtractSliceFilter<MaskImageType> ExtractSliceFilterType;
88 typedef typename ExtractSliceFilterType::SliceType SliceType;
89 typename ExtractSliceFilterType::Pointer
90 extractSliceFilter = ExtractSliceFilterType::New();
91 extractSliceFilter->SetInput(crop_trachea);
92 extractSliceFilter->SetDirection(2);
93 extractSliceFilter->Update();
94 std::vector<typename SliceType::Pointer> trachea_slices;
95 extractSliceFilter->GetOutputSlices(trachea_slices);
100 //--------------------------------------------------------------------