Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

QmitkIsoSurface Class Reference
[Internal]

IsoSurface. More...

#include <QmitkIsoSurface.h>

Inheritance diagram for QmitkIsoSurface:
Inheritance graph
[legend]
Collaboration diagram for QmitkIsoSurface:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QmitkIsoSurface (QObject *parent=0, const char *name=0)
 default constructor
virtual ~QmitkIsoSurface ()
virtual void CreateQtPartControl (QWidget *parent)
 method for creating the widget containing the application controls, like sliders, buttons etc.
virtual void CreateConnections ()
 method for creating the applications main widget
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
 method for creating an QAction object, i.e. button & menu entry
virtual void StdMultiWidgetNotAvailable ()

Protected Slots

virtual void DataStorageChanged ()
void ImageSelected (const mitk::DataNode *item)
void CreateSurface ()
 method for creating a surface object

Protected Member Functions

float getThreshold ()

Protected Attributes

Ui::QmitkIsoSurfaceControlsm_Controls
mitk::Imagem_MitkImage
int m_SurfaceCounter
mitk::ColorSequenceRainbow m_RainbowColor

Detailed Description

IsoSurface.

See also:
QmitkFunctionality

Definition at line 35 of file QmitkIsoSurface.h.


Constructor & Destructor Documentation

QmitkIsoSurface::QmitkIsoSurface ( QObject *  parent = 0,
const char *  name = 0 
)

default constructor

Definition at line 44 of file QmitkIsoSurface.cpp.

: QmitkFunctionality() ,
  m_Controls(NULL),
  m_MitkImage(NULL),
  m_SurfaceCounter(0)
{
  //SetAvailability(true);
}
QmitkIsoSurface::~QmitkIsoSurface (  ) [virtual]

Member Function Documentation

void QmitkIsoSurface::CreateConnections (  ) [virtual]

method for creating the applications main widget

method for creating the connections of main and control widget

Definition at line 87 of file QmitkIsoSurface.cpp.

References CreateSurface(), Ui_QmitkIsoSurfaceControls::createSurfacePushButton, ImageSelected(), m_Controls, Ui_QmitkIsoSurfaceControls::m_ImageSelector, and QmitkFunctionality::OnSelectionChanged().

Referenced by CreateQtPartControl().

{
  if ( m_Controls )
  {
    connect( m_Controls->m_ImageSelector, SIGNAL(OnSelectionChanged(const mitk::DataNode*)), this, SLOT(ImageSelected(const mitk::DataNode*)) );
    connect( m_Controls->createSurfacePushButton, SIGNAL(clicked()), this, SLOT(CreateSurface()) );
  }
}
void QmitkIsoSurface::CreateQtPartControl ( QWidget *  parent ) [virtual]
void QmitkIsoSurface::CreateSurface (  ) [protected, slot]

method for creating a surface object

Definition at line 121 of file QmitkIsoSurface.cpp.

References QmitkFunctionality::GetActiveStdMultiWidget(), QmitkFunctionality::GetDefaultDataStorage(), mitk::ColorSequenceRainbow::GetNextColor(), QmitkDataStorageComboBox::GetSelectedNode(), getThreshold(), m_Controls, Ui_QmitkIsoSurfaceControls::m_ImageSelector, m_MitkImage, m_RainbowColor, m_SurfaceCounter, mitk::StringProperty::New(), mitk::BoolProperty::New(), mitk::DataNode::New(), mitk::ManualSegmentationToSurfaceFilter::New(), and QmitkStdMultiWidget::RequestUpdate().

Referenced by CreateConnections().

{
  QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
  if(m_MitkImage != NULL)
  {
    //Value Gauss
    //float gsDev = 1.5;

    //Value for DecimatePro
    float targetReduction = 0.05;

    //ImageToSurface Instance
    mitk::DataNode::Pointer node = m_Controls->m_ImageSelector->GetSelectedNode();

    /*
    mitk::DataTreeIteratorClone  iteratorOnImageToBeSkinExtracted;

    iteratorOnImageToBeSkinExtracted = m_Controls->m_ImageSelector->GetFilter()->GetIteratorToSelectedItem();
    if(iteratorOnImageToBeSkinExtracted.IsNull())
    {
      iteratorOnImageToBeSkinExtracted = CommonFunctionality::GetIteratorToFirstImage(m_DataTreeIterator.GetPointer());
    }
    */

    mitk::ManualSegmentationToSurfaceFilter::Pointer filter = mitk::ManualSegmentationToSurfaceFilter::New();
    if (filter.IsNull())
    {
      std::cout<<"NULL Pointer for ManualSegmentationToSurfaceFilter"<<std::endl;
      return;
    }

    filter->SetInput( m_MitkImage );
    filter->SetGaussianStandardDeviation( 0.5 );
    filter->SetUseGaussianImageSmooth( true );
    filter->SetThreshold( getThreshold()); //if( Gauss ) --> TH manipulated for vtkMarchingCube

    filter->SetTargetReduction( targetReduction );


    int numOfPolys = filter->GetOutput()->GetVtkPolyData()->GetNumberOfPolys();
    if(numOfPolys>2000000)
    {
      QApplication::restoreOverrideCursor();
      if(QMessageBox::question(NULL, "CAUTION!!!", "The number of polygons is greater than 2 000 000. If you continue, the program might crash. How do you want to go on?", "Proceed anyway!", "Cancel immediately! (maybe you want to insert an other threshold)!",QString::null,0 ,1)==1)
      {

        return;
      }
          QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
    }
    mitk::DataNode::Pointer surfaceNode = mitk::DataNode::New();
    surfaceNode->SetData( filter->GetOutput() );

    int layer = 0;

    ++m_SurfaceCounter;
    std::ostringstream buffer;
    buffer << m_SurfaceCounter;
    std::string surfaceNodeName = "Surface " + buffer.str();

    node->GetIntProperty("layer", layer);
    surfaceNode->SetIntProperty("layer", layer+1);
    surfaceNode->SetProperty("Surface", mitk::BoolProperty::New(true));
    surfaceNode->SetProperty("name", mitk::StringProperty::New(surfaceNodeName));

    /*
    mitk::DataTreeIteratorClone iteratorClone = m_DataTreeIterator;
    bool isSurface = false;

    while(!(iteratorClone->IsAtEnd())&&(isSurface == false))
    {
      iteratorClone->Get()->GetBoolProperty("Surface", isSurface);
      if(isSurface == false)
      {
        ++iteratorClone;
      }
    }

    iteratorClone= iteratorOnImageToBeSkinExtracted;
    iteratorClone->Add(surfaceNode);
    iteratorClone->GetTree()->Modified();
    */
    this->GetDefaultDataStorage()->Add(surfaceNode, node);

    mitk::Surface::Pointer surface = filter->GetOutput();

    //to show surfaceContur
    surfaceNode->SetColor( m_RainbowColor.GetNextColor() );
    surfaceNode->SetVisibility(true);

    this->GetActiveStdMultiWidget()->RequestUpdate();

  }//if m_MitkImage != NULL

  QApplication::restoreOverrideCursor();
}
void QmitkIsoSurface::DataStorageChanged (  ) [protected, virtual, slot]

Called when a DataStorage add *or* remove *or* change event was thrown. May be reimplemented by deriving classes.

Reimplemented from QmitkFunctionality.

Definition at line 105 of file QmitkIsoSurface.cpp.

{
    //m_Controls->m_ImageSelector->Update();
}
float QmitkIsoSurface::getThreshold (  ) [protected]

read thresholdvalue from GUI and convert it to float

Definition at line 219 of file QmitkIsoSurface.cpp.

References m_Controls, and Ui_QmitkIsoSurfaceControls::thresholdLineEdit.

Referenced by CreateSurface().

{
  return m_Controls->thresholdLineEdit->text().toFloat();
}
void QmitkIsoSurface::ImageSelected ( const mitk::DataNode item ) [protected, slot]

Definition at line 111 of file QmitkIsoSurface.cpp.

References mitk::DataNode::GetData(), and m_MitkImage.

Referenced by CreateConnections().

{
  // nothing selected (NULL selection)
  if( item == 0  || item->GetData() == 0 )
    return;

  m_MitkImage = dynamic_cast<mitk::Image*> (item->GetData());
}
void QmitkIsoSurface::StdMultiWidgetAvailable ( QmitkStdMultiWidget stdMultiWidget ) [virtual]

method for creating an QAction object, i.e. button & menu entry

Parameters:
parentthe parent QWidget Called when a StdMultiWidget is available.

Reimplemented from QmitkFunctionality.

Definition at line 224 of file QmitkIsoSurface.cpp.

References QmitkFunctionality::m_Parent.

{
  m_Parent->setEnabled(true);
}
void QmitkIsoSurface::StdMultiWidgetNotAvailable (  ) [virtual]

Called when no StdMultiWidget is available.

Reimplemented from QmitkFunctionality.

Definition at line 229 of file QmitkIsoSurface.cpp.

References QmitkFunctionality::m_Parent.

{
  m_Parent->setEnabled(false);
}

Member Data Documentation

default main widget containing 4 windows showing 3 orthogonal slices of the volume and a 3d render window

controls containing sliders for scrolling through the slices

Definition at line 101 of file QmitkIsoSurface.h.

Referenced by CreateConnections(), CreateQtPartControl(), CreateSurface(), getThreshold(), and ~QmitkIsoSurface().

image which is used to create the surface

Definition at line 106 of file QmitkIsoSurface.h.

Referenced by CreateSurface(), and ImageSelected().

Definition at line 118 of file QmitkIsoSurface.h.

Referenced by CreateSurface().

variable to count Surfaces and give it to name

Definition at line 116 of file QmitkIsoSurface.h.

Referenced by CreateSurface().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines