Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "mitkContour.h"
00020
00021 mitk::Contour::Contour() :
00022 m_ContourPath (PathType::New()),
00023 m_CurrentWindow ( NULL ),
00024 m_BoundingBox (BoundingBoxType::New()),
00025 m_Vertices ( BoundingBoxType::PointsContainer::New() ),
00026 m_Closed ( true ),
00027 m_Selected ( false ),
00028 m_Width (3.0)
00029 {
00030 Superclass::InitializeTimeSlicedGeometry();
00031 }
00032
00033 mitk::Contour::~Contour()
00034 {
00035 }
00036
00037 void mitk::Contour::AddVertex(mitk::Point3D newPoint)
00038 {
00039 BoundingBoxType::PointType p;
00040 p.CastFrom(newPoint);
00041 m_Vertices->InsertElement(m_Vertices->Size(), p);
00042 ContinuousIndexType idx;
00043 idx.CastFrom(newPoint);
00044 m_ContourPath->AddVertex(idx);
00045 m_BoundingBox->SetPoints(m_Vertices);
00046 Modified();
00047 }
00048
00049 void mitk::Contour::UpdateOutputInformation()
00050 {
00051
00052 float mitkBounds[6];
00053 if (m_Vertices->Size() == 0) {
00054 mitkBounds[0] = 0.0;
00055 mitkBounds[1] = 0.0;
00056 mitkBounds[2] = 0.0;
00057 mitkBounds[3] = 0.0;
00058 mitkBounds[4] = 0.0;
00059 mitkBounds[5] = 0.0;
00060 }
00061 else
00062 {
00063 m_BoundingBox->ComputeBoundingBox();
00064 BoundingBoxType::BoundsArrayType tmp = m_BoundingBox->GetBounds();
00065 mitkBounds[0] = tmp[0];
00066 mitkBounds[1] = tmp[1];
00067 mitkBounds[2] = tmp[2];
00068 mitkBounds[3] = tmp[3];
00069 mitkBounds[4] = tmp[4];
00070 mitkBounds[5] = tmp[5];
00071 }
00072 Geometry3D* geometry3d = GetGeometry(0);
00073 geometry3d->SetBounds(mitkBounds);
00074 GetTimeSlicedGeometry()->UpdateInformation();
00075 }
00076
00077 void mitk::Contour::SetRequestedRegionToLargestPossibleRegion()
00078 {
00079 }
00080
00081 bool mitk::Contour::RequestedRegionIsOutsideOfTheBufferedRegion()
00082 {
00083 return false;
00084 }
00085
00086 bool mitk::Contour::VerifyRequestedRegion()
00087 {
00088 return true;
00089 }
00090
00091 void mitk::Contour::SetRequestedRegion(itk::DataObject*)
00092 {
00093 }
00094
00095 mitk::Contour::PathType::Pointer mitk::Contour::GetContourPath() const
00096 {
00097 return m_ContourPath;
00098 }
00099
00100 void mitk::Contour::SetCurrentWindow(vtkRenderWindow* rw)
00101 {
00102 m_CurrentWindow = rw;
00103 }
00104
00105 vtkRenderWindow* mitk::Contour::GetCurrentWindow() const
00106 {
00107 return m_CurrentWindow;
00108 }
00109
00110 void mitk::Contour::Initialize()
00111 {
00112 m_ContourPath = PathType::New();
00113 m_ContourPath->Initialize();
00114 m_BoundingBox = BoundingBoxType::New();
00115 m_Vertices = BoundingBoxType::PointsContainer::New();
00116 GetTimeSlicedGeometry()->Initialize(1);
00117 }
00118
00119 unsigned int mitk::Contour::GetNumberOfPoints() const
00120 {
00121 return m_Vertices->Size();
00122 }
00123
00124 mitk::Contour::PointsContainerPointer
00125 mitk::Contour::GetPoints() const
00126 {
00127 return m_Vertices;
00128 }
00129
00130 void mitk::Contour::SetPoints(mitk::Contour::PointsContainerPointer points)
00131 {
00132 m_Vertices = points;
00133 Modified();
00134 }
00135
00136 void mitk::Contour::PrintSelf( std::ostream& os, itk::Indent indent) const
00137 {
00138 Superclass::PrintSelf( os, indent );
00139
00140 os << indent << "Number of verticies: " << GetNumberOfPoints() << std::endl;
00141
00142 mitk::Contour::PointsContainerIterator pointsIt = m_Vertices->Begin(), end = m_Vertices->End();
00143
00144 os << indent << "Verticies: " << std::endl;
00145
00146 int i = 0;
00147 while ( pointsIt != end )
00148 {
00149 os << indent << indent << i << ": " << pointsIt.Value() << std::endl;
00150 ++pointsIt; ++i;
00151 }
00152 }