00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef MITKPLANESPERPENDICULARTOLINES_H_HEADER_INCLUDED_C10B22CD 00019 #define MITKPLANESPERPENDICULARTOLINES_H_HEADER_INCLUDED_C10B22CD 00020 00021 #include "mitkGeometryDataSource.h" 00022 #include "MitkExtExports.h" 00023 #include "mitkMesh.h" 00024 #include "mitkGeometryData.h" 00025 #include "mitkPlaneGeometry.h" 00026 #include "mitkSlicedGeometry3D.h" 00027 00028 namespace mitk { 00029 00030 //##Documentation 00031 //## @brief Create Planes perpendicular to lines contained in a Mesh. The planes data is generated as one SlicedGeometry3D data. 00032 //## To create the planes as input a 00033 //## mitk::mesh (for example a pointSet) and as geometry hint a geometry (for example from the original image) must be given. 00034 //## 00035 //## mitk::Mesh::Pointer mesh = mitk::Mesh::New(); 00036 //## mesh->SetMesh(pointSet->GetPointSet()); 00037 //## mitk::Image* currentImage = dynamic_cast<mitk::Image*> (myDataStorage->GetNamedNode(IMAGE)->GetData()); 00038 //## const mitk::Geometry3D* imagegeometry = currentImage->GetUpdatedGeometry(); 00039 //## mitk::PlanesPerpendicularToLinesFilter::Pointer perpendicularPlanes = mitk::PlanesPerpendicularToLinesFilter::New(); 00040 //## perpendicularPlanes->SetInput(mesh); 00041 //## perpendicularPlanes->SetUseAllPoints(true); 00042 //## perpendicularPlanes->SetFrameGeometry(imagegeometry); 00043 //## perpendicularPlanes->Update(); 00044 //## 00045 //## To get one single plane out of these use SlicedGeometry3D->GetGeometry2D(int slicenumber). 00046 00047 00048 00049 //## @ingroup Process 00050 class MitkExt_EXPORT PlanesPerpendicularToLinesFilter : public GeometryDataSource 00051 { 00052 public: 00053 mitkClassMacro(PlanesPerpendicularToLinesFilter, GeometryDataSource); 00054 itkNewMacro(Self); 00055 00056 virtual void GenerateOutputInformation(); 00057 00058 virtual void GenerateData(); 00059 00060 const mitk::Mesh *GetInput(void); 00061 00062 //## @brief Set the input mesh that is used to create the planes. 00063 virtual void SetInput(const mitk::Mesh *image); 00064 00065 //##Documentation 00066 //## @brief Set plane to be used as an example of the planes to move 00067 //## along the lines in the input mesh. 00068 //## 00069 //## The size and spacing are copied from the plane. The in-plane 00070 //## orientation (right-vector) of the created planes are set as 00071 //## parallel as possible to the orientation (right-vector) of the 00072 //## the plane set using this method. 00073 //## @note The PlaneGeometry is cloned, @em not linked/referenced. 00074 virtual void SetPlane(const mitk::PlaneGeometry* aPlane); 00075 00076 //##Documentation 00077 //## @brief Set if all points in the mesh should be interpreted as 00078 //## one long line. 00079 //## 00080 //## Cells are not used in this mode, but all points in the order 00081 //## of their indices form the line. 00082 //## Default is @a false. 00083 itkGetConstMacro(UseAllPoints, bool); 00084 00085 //##Documentation 00086 //## @brief Set if all points of the mesh shall be used (true) or the cells (false) 00087 //## Default is @a false. 00088 itkSetMacro(UseAllPoints, bool); 00089 itkBooleanMacro(UseAllPoints); 00090 00091 //##Documentation 00092 //## @brief Set an explicit frame of the created sliced geometry 00093 //## 00094 //## Set an explicit framegeometry for the created sliced geometry. This framegeometry is 00095 //## used as geometry for all created planes. 00096 //## Uses the IndexToWorldTransform and bounding box of the 00097 //## provided geometry. 00098 //## \sa CalculateFrameGeometry 00099 virtual void SetFrameGeometry(const mitk::Geometry3D* frameGeometry); 00100 00101 protected: 00102 PlanesPerpendicularToLinesFilter(); 00103 00104 virtual ~PlanesPerpendicularToLinesFilter(); 00105 00106 //## @brief Creates the plane at point curr 00107 //## 00108 //## Creates the plane at point curr. To create this plane, the last point must 00109 //## must be renowned. 00110 //## \sa SetPlane 00111 void CreatePlane(const Point3D& curr); 00112 00113 //## @brief Plane to be used as an example of the planes to move 00114 //## along the lines in the input mesh. 00115 //## 00116 //## The size and spacing are copied from the m_Plane. The in-plane 00117 //## orientation (right-vector) of the created planes are set as 00118 //## parallel as possible to the orientation (right-vector) of m_Plane. 00119 //## \sa SetPlane 00120 mitk::PlaneGeometry::Pointer m_Plane; 00121 00122 bool m_UseAllPoints; 00123 00124 //##Documentation 00125 //## @brief SlicedGeometry3D containing the created planes 00126 //## 00127 SlicedGeometry3D::Pointer m_CreatedGeometries; 00128 00129 mitk::Geometry3D::Pointer m_FrameGeometry; 00130 00131 private: 00132 std::deque<mitk::PlaneGeometry::Pointer> planes; 00133 Point3D last; 00134 VnlVector normal; 00135 VnlVector right, down; 00136 VnlVector targetRight; 00137 Vector3D targetSpacing; 00138 ScalarType halfWidthInMM, halfHeightInMM; 00139 mitk::AffineGeometryFrame3D::BoundsArrayType bounds; 00140 Point3D origin; 00141 }; 00142 00143 } // namespace mitk 00144 00145 #endif /* MITKPLANESPERPENDICULARTOLINES_H_HEADER_INCLUDED_C10B22CD */