+ // Declare all needed points (sp = slice point)
+ typename MaskSliceType::PointType sp_maxRight_Eso;
+ typename MaskSliceType::PointType sp_maxRight_Aorta;
+ typename MaskSliceType::PointType sp_maxRight_Vertebra;
+ typename MaskSliceType::PointType sp_maxLeft_Eso;
+ typename MaskSliceType::PointType sp_maxLeft_Aorta;
+ typename MaskSliceType::PointType sp_maxLeft_Vertebra;
+
+ // Right is at left on screen, coordinate decrease
+ // Left is at right on screen, coordinate increase
+
+ // Find right limit of Esophagus and Aorta
+ clitk::FindExtremaPointInAGivenDirection<MaskSliceType>(eso_slices[i], GetBackgroundValue(), 0, true, sp_maxRight_Eso);
+ clitk::FindExtremaPointInAGivenDirection<MaskSliceType>(aorta_slices[i], GetBackgroundValue(), 0, true, sp_maxRight_Aorta);
+ clitk::PointsUtils<MaskImageType>::Convert2DTo3D(sp_maxRight_Eso, EsophagusForSlice, i, p);
+ clitk::PointsUtils<MaskImageType>::Convert2DTo3D(sp_maxRight_Aorta, Aorta, i, pp);
+ pp[0] -= 2; // Add a margin of 2 mm to include the 'wall'
+ p_AllPoints.push_back(p);
+ p_AllPoints.push_back(pp);
+ if (p[0]<pp[0]) p_RightMostAnt.push_back(p); // Insert point most at right
+ else p_RightMostAnt.push_back(pp);
+
+ // Find limit of Vertebral -> only at most Post part of current
+ // slice support. First found most ant point in VertebralBody
+ typedef MaskSliceType SliceType;
+ typename SliceType::PointType p_slice_ant;
+ bool found = clitk::FindExtremaPointInAGivenDirection<SliceType>(vert_slices[i], GetBackgroundValue(), 1, true, p_slice_ant);
+ if (!found) {
+ // It should not happen ! But sometimes, a contour is missing or
+ // the VertebralBody is not delineated enough inferiorly ... in
+ // those cases, we consider the first found slice.
+ std::cerr << "No foreground pixels in this VertebralBody slices !?? I try with the previous/next slice" << std::endl;
+ DD(i);
+ int j=i++;
+ bool found = false;
+ while (!found) {
+ found = clitk::FindExtremaPointInAGivenDirection<SliceType>(vert_slices[j], GetBackgroundValue(), 1, true, p_slice_ant);
+ //clitkExceptionMacro("No foreground pixels in this VertebralBody slices ??");
+ j++;
+ }
+ DD(j);
+ }
+ p_slice_ant[1] += GetDistanceMaxToAnteriorPartOfTheSpine(); // Consider offset