Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkContourUtils.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkContourUtils.h"
14 #include "mitkContourModelUtils.h"
15 
17 {
18 }
19 
21 {
22 }
23 
25  Contour *contourIn3D,
26  bool itkNotUsed(correctionForIpSegmentation),
27  bool constrainToInside)
28 {
29  mitk::Contour::PointsContainerIterator it = contourIn3D->GetPoints()->Begin();
30  mitk::Contour::PointsContainerIterator end = contourIn3D->GetPoints()->End();
31 
33 
34  while (it != end)
35  {
36  contour->AddVertex(it.Value());
37  it++;
38  }
39  return mitk::ContourModelUtils::ProjectContourTo2DSlice(slice, contour, false /*not used*/, constrainToInside);
40 }
41 
43  const BaseGeometry *sliceGeometry, Contour *contourIn2D, bool itkNotUsed(correctionForIpSegmentation))
44 {
45  mitk::Contour::PointsContainerIterator it = contourIn2D->GetPoints()->Begin();
46  mitk::Contour::PointsContainerIterator end = contourIn2D->GetPoints()->End();
47 
49 
50  while (it != end)
51  {
52  contour->AddVertex(it.Value());
53  it++;
54  }
55  return mitk::ContourModelUtils::BackProjectContourFrom2DSlice(sliceGeometry, contour, false /*not used*/);
56 }
57 
58 void mitk::ContourUtils::FillContourInSlice(Contour *projectedContour, Image *sliceImage, int paintingPixelValue)
59 {
60  mitk::Contour::PointsContainerIterator it = projectedContour->GetPoints()->Begin();
61  mitk::Contour::PointsContainerIterator end = projectedContour->GetPoints()->End();
62 
64 
65  while (it != end)
66  {
67  contour->AddVertex(it.Value());
68  it++;
69  }
70  mitk::ContourModelUtils::FillContourInSlice(contour, sliceImage, sliceImage, paintingPixelValue);
71 }
static ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry, ContourModel *contourIn2D, bool correctionForIpSegmentation=false)
Projects a slice index coordinates of a contour back into world coordinates.
ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry, Contour *contourIn2D, bool correctionForIpSegmentation=false)
Projects a slice index coordinates of a contour back into world coordinates.
BoundingBoxType::PointsContainerIterator PointsContainerIterator
Definition: mitkContour.h:51
static void FillContourInSlice(ContourModel *projectedContour, Image *sliceImage, mitk::Image::Pointer workingImage, int paintingPixelValue=1)
Fill a contour in a 2D slice with a specified pixel value at time step 0.
Stores vertices for drawing a contour.
Definition: mitkContour.h:31
PointsContainerPointer GetPoints() const
ContourModel::Pointer ProjectContourTo2DSlice(Image *slice, Contour *contourIn3D, bool correctionForIpSegmentation, bool constrainToInside)
Projects a contour onto an image point by point. Converts from world to index coordinates.
Image class for storing images.
Definition: mitkImage.h:72
void FillContourInSlice(Contour *projectedContour, Image *sliceImage, int paintingPixelValue=1)
Fill a contour in a 2D slice with a specified pixel value.
static ContourModel::Pointer ProjectContourTo2DSlice(Image *slice, ContourModel *contourIn3D, bool correctionForIpSegmentation, bool constrainToInside)
Projects a contour onto an image point by point. Converts from world to index coordinates.
static Pointer New()
BaseGeometry Describes the geometry of a data object.