#include <mitkShowSegmentationAsSurface.h>
Public Types | |
typedef ShowSegmentationAsSurface | Self |
typedef SegmentationSink | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual ::itk::LightObject::Pointer | CreateAnother (void) const |
Static Public Member Functions | |
static Pointer | New (void) |
Protected Member Functions | |
ShowSegmentationAsSurface () | |
virtual | ~ShowSegmentationAsSurface () |
virtual void | Initialize (const NonBlockingAlgorithm *other=NULL) |
virtual bool | ReadyToRun () |
virtual bool | ThreadedUpdateFunction () |
virtual void | ThreadedUpdateSuccessful () |
Definition at line 29 of file mitkShowSegmentationAsSurface.h.
typedef itk::SmartPointer<const Self> mitk::ShowSegmentationAsSurface::ConstPointer |
Reimplemented from mitk::SegmentationSink.
Definition at line 33 of file mitkShowSegmentationAsSurface.h.
typedef itk::SmartPointer<Self> mitk::ShowSegmentationAsSurface::Pointer |
Reimplemented from mitk::SegmentationSink.
Definition at line 33 of file mitkShowSegmentationAsSurface.h.
Reimplemented from mitk::SegmentationSink.
Definition at line 33 of file mitkShowSegmentationAsSurface.h.
Reimplemented from mitk::SegmentationSink.
Definition at line 33 of file mitkShowSegmentationAsSurface.h.
mitk::ShowSegmentationAsSurface::ShowSegmentationAsSurface | ( | ) | [protected] |
Definition at line 22 of file mitkShowSegmentationAsSurface.cpp.
{
mitk::ShowSegmentationAsSurface::~ShowSegmentationAsSurface | ( | ) | [protected, virtual] |
Definition at line 29 of file mitkShowSegmentationAsSurface.cpp.
:m_UIDGeneratorSurfaces("Surface_"), m_AddToTree(false)
virtual ::itk::LightObject::Pointer mitk::ShowSegmentationAsSurface::CreateAnother | ( | void | ) | const [inline, virtual] |
Reimplemented from mitk::SegmentationSink.
Definition at line 34 of file mitkShowSegmentationAsSurface.h.
:
virtual const char* mitk::ShowSegmentationAsSurface::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::SegmentationSink.
void mitk::ShowSegmentationAsSurface::Initialize | ( | const NonBlockingAlgorithm * | other = NULL ) |
[protected, virtual] |
Reimplemented from mitk::SegmentationSink.
Definition at line 33 of file mitkShowSegmentationAsSurface.cpp.
{ } void ShowSegmentationAsSurface::Initialize(const NonBlockingAlgorithm* other) { Superclass::Initialize(other); bool syncVisibility(false); if (other) { other->GetParameter("Sync visibility", syncVisibility); } SetParameter("Sync visibility", syncVisibility ); SetParameter("Median kernel size", 3u);
static Pointer mitk::ShowSegmentationAsSurface::New | ( | void | ) | [inline, static] |
Reimplemented from mitk::SegmentationSink.
Definition at line 34 of file mitkShowSegmentationAsSurface.h.
Referenced by QmitkSegmentationPostProcessing::InternalCreateSurface(), and mitk::CreateSurfaceTool::ProcessOneWorkingData().
:
bool mitk::ShowSegmentationAsSurface::ReadyToRun | ( | ) | [protected, virtual] |
Reimplemented from mitk::SegmentationSink.
Definition at line 55 of file mitkShowSegmentationAsSurface.cpp.
{ try { Image::Pointer image; GetPointerParameter("Input", image);
bool mitk::ShowSegmentationAsSurface::ThreadedUpdateFunction | ( | ) | [protected, virtual] |
Reimplemented from mitk::SegmentationSink.
Definition at line 71 of file mitkShowSegmentationAsSurface.cpp.
{ return false; } } bool ShowSegmentationAsSurface::ThreadedUpdateFunction() { Image::Pointer image; GetPointerParameter("Input", image); bool smooth(true); GetParameter("Smooth", smooth); bool applyMedian(true); GetParameter("Apply median", applyMedian); bool decimateMesh(true); GetParameter("Decimate mesh", decimateMesh); unsigned int medianKernelSize(3); GetParameter("Median kernel size", medianKernelSize); float gaussianSD(1.5); GetParameter("Gaussian SD", gaussianSD ); float reductionRate(0.8); GetParameter("Decimation rate", reductionRate ); MITK_INFO << "Creating polygon model with smoothing " << smooth << " gaussianSD " << gaussianSD << " median " << applyMedian << " median kernel " << medianKernelSize << " mesh reduction " << decimateMesh << " reductionRate " << reductionRate; ManualSegmentationToSurfaceFilter::Pointer surfaceFilter = ManualSegmentationToSurfaceFilter::New(); surfaceFilter->SetInput( image ); surfaceFilter->SetThreshold( 1 ); //expects binary image with zeros and ones surfaceFilter->SetUseGaussianImageSmooth(smooth); // apply gaussian to thresholded image ? if (smooth) { surfaceFilter->InterpolationOn(); surfaceFilter->SetGaussianStandardDeviation( gaussianSD ); //surfaceFilter->SetGaussianStandardDeviation( 3 ); //surfaceFilter->SetUseGaussianImageSmooth(true); } surfaceFilter->SetMedianFilter3D(applyMedian); // apply median to segmentation before marching cubes ? if (applyMedian) { surfaceFilter->SetMedianKernelSize(medianKernelSize, medianKernelSize, medianKernelSize); // apply median to segmentation before marching cubes } if (decimateMesh) { surfaceFilter->SetDecimate( ImageToSurfaceFilter::DecimatePro ); surfaceFilter->SetTargetReduction( reductionRate ); } else { surfaceFilter->SetDecimate( ImageToSurfaceFilter::NoDecimation ); } surfaceFilter->UpdateLargestPossibleRegion(); // calculate normals for nicer display m_Surface = surfaceFilter->GetOutput(); vtkPolyData* polyData = m_Surface->GetVtkPolyData(); if (!polyData) throw std::logic_error("Could not create polygon model"); polyData->SetVerts(0); polyData->SetLines(0); if ( smooth || applyMedian || decimateMesh) { vtkPolyDataNormals* normalsGen = vtkPolyDataNormals::New(); normalsGen->SetInput( polyData ); normalsGen->Update(); m_Surface->SetVtkPolyData( normalsGen->GetOutput() ); normalsGen->Delete(); }
void mitk::ShowSegmentationAsSurface::ThreadedUpdateSuccessful | ( | ) | [protected, virtual] |
Reimplemented from mitk::NonBlockingAlgorithm.
Definition at line 158 of file mitkShowSegmentationAsSurface.cpp.
{ m_Surface->SetVtkPolyData( polyData ); } return true; } void ShowSegmentationAsSurface::ThreadedUpdateSuccessful() { m_Node = LookForPointerTargetBelowGroupNode("Surface representation"); m_AddToTree = m_Node.IsNull(); if (m_AddToTree) { m_Node = DataNode::New(); bool wireframe(false); GetParameter("Wireframe", wireframe ); if (wireframe) { VtkRepresentationProperty *np = dynamic_cast<VtkRepresentationProperty*>(m_Node->GetProperty("material.representation")); if (np) np->SetRepresentationToWireframe(); } m_Node->SetProperty("opacity", FloatProperty::New(0.3) ); m_Node->SetProperty("line width", IntProperty::New(1) ); m_Node->SetProperty("scalar visibility", BoolProperty::New(false) ); std::string uid = m_UIDGeneratorSurfaces.GetUID(); m_Node->SetProperty( "FILENAME", StringProperty::New( uid + ".vtk" ) ); // undocumented feature of Image::WriteXMLData std::string groupNodesName ("surface"); DataNode* groupNode = GetGroupNode(); if (groupNode) { groupNode->GetName( groupNodesName ); } m_Node->SetProperty( "name", StringProperty::New(groupNodesName) ); // synchronize this object's color with the parent's color //surfaceNode->SetProperty( "color", parentNode->GetProperty( "color" ) ); //surfaceNode->SetProperty( "visible", parentNode->GetProperty( "visible" ) ); } m_Node->SetData( m_Surface ); if (m_AddToTree) { DataNode* groupNode = GetGroupNode(); if (groupNode) { groupNode->SetProperty( "Surface representation", SmartPointerProperty::New(m_Node) ); BaseProperty* colorProp = groupNode->GetProperty("color"); if (colorProp) m_Node->ReplaceProperty("color", colorProp); else m_Node->SetProperty("color", ColorProperty::New(1.0, 1.0, 0.0)); bool showResult(true); GetParameter("Show result", showResult ); bool syncVisibility(false); GetParameter("Sync visibility", syncVisibility ); Image::Pointer image; GetPointerParameter("Input", image); BaseProperty* organTypeProp = image->GetProperty("organ type"); if (organTypeProp) m_Surface->SetProperty("organ type", organTypeProp); BaseProperty* visibleProp = groupNode->GetProperty("visible"); if (visibleProp && syncVisibility) m_Node->ReplaceProperty("visible", visibleProp); else m_Node->SetProperty("visible", BoolProperty::New(showResult));