Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkContourUtils.h"
18 #include "mitkContourModelUtils.h"
19 
21 {
22 }
23 
25 {
26 }
27 
29  Contour *contourIn3D,
30  bool itkNotUsed(correctionForIpSegmentation),
31  bool constrainToInside)
32 {
33  mitk::Contour::PointsContainerIterator it = contourIn3D->GetPoints()->Begin();
34  mitk::Contour::PointsContainerIterator end = contourIn3D->GetPoints()->End();
35 
37 
38  while (it != end)
39  {
40  contour->AddVertex(it.Value());
41  it++;
42  }
43  return mitk::ContourModelUtils::ProjectContourTo2DSlice(slice, contour, false /*not used*/, constrainToInside);
44 }
45 
47  const BaseGeometry *sliceGeometry, Contour *contourIn2D, bool itkNotUsed(correctionForIpSegmentation))
48 {
49  mitk::Contour::PointsContainerIterator it = contourIn2D->GetPoints()->Begin();
50  mitk::Contour::PointsContainerIterator end = contourIn2D->GetPoints()->End();
51 
53 
54  while (it != end)
55  {
56  contour->AddVertex(it.Value());
57  it++;
58  }
59  return mitk::ContourModelUtils::BackProjectContourFrom2DSlice(sliceGeometry, contour, false /*not used*/);
60 }
61 
62 void mitk::ContourUtils::FillContourInSlice(Contour *projectedContour, Image *sliceImage, int paintingPixelValue)
63 {
64  mitk::Contour::PointsContainerIterator it = projectedContour->GetPoints()->Begin();
65  mitk::Contour::PointsContainerIterator end = projectedContour->GetPoints()->End();
66 
68 
69  while (it != end)
70  {
71  contour->AddVertex(it.Value());
72  it++;
73  }
74  mitk::ContourModelUtils::FillContourInSlice(contour, sliceImage, sliceImage, paintingPixelValue);
75 }
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:53
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:35
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:76
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.
PointsContainerPointer GetPoints() const
static Pointer New()
BaseGeometry Describes the geometry of a data object.