Functions

mitkContourMapper2DTest.cpp File Reference

#include "mitkContour.h"
#include "mitkDataNode.h"
#include "mitkContourMapper2D.h"
#include "mitkCommon.h"
#include "mitkStandaloneDataStorage.h"
#include "mitkGlobalInteraction.h"
#include "mitkVtkPropRenderer.h"
#include <fstream>

Go to the source code of this file.

Functions

int mitkContourMapper2DTest (int, char *[])

Function Documentation

int mitkContourMapper2DTest ( int  ,
char *  [] 
)

Definition at line 30 of file mitkContourMapper2DTest.cpp.

References EXIT_FAILURE, EXIT_SUCCESS, mitk::RenderingManager::GetInstance(), mitk::GlobalInteraction::GetInstance(), mitk::VtkPropRenderer::New(), mitk::StandaloneDataStorage::New(), mitk::Contour::New(), mitk::DataNode::New(), and mitk::ContourMapper2D::New().

{
  mitk::Contour::Pointer contour;
  mitk::ContourMapper2D::Pointer contourMapper;
  mitk::DataNode::Pointer node;

  // Global interaction must(!) be initialized if used
  mitk::GlobalInteraction::GetInstance()->Initialize("global");

  contourMapper = mitk::ContourMapper2D::New();
  node = mitk::DataNode::New();
  std::cout << "Testing mitk::ContourMapper2D::New(): ";

  contour = mitk::Contour::New();
  node->SetData(contour);

  if (contour.IsNull()) {
    std::cout << "[FAILED]" << std::endl;
    return EXIT_FAILURE;
  }
  else {
  std::cout<<"[PASSED]"<<std::endl;
  }

  contourMapper->SetDataNode( node );
  contourMapper->Update(NULL);
  mitk::Contour* testContour = (mitk::Contour*)contourMapper->GetInput();
  std::cout << testContour << std::endl;
  
  mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();

  ds->Add( node );

  mitk::BoundingBox::Pointer bounds = ds->ComputeBoundingBox();

  std::cout << "bounds: " << bounds << std::endl;

  bounds = ds->ComputeVisibleBoundingBox();
  std::cout << "visible bounds: " << bounds << std::endl;

  vtkRenderWindow* renWin = vtkRenderWindow::New();

  mitk::VtkPropRenderer::Pointer renderer = mitk::VtkPropRenderer::New( "ContourRenderer",renWin, mitk::RenderingManager::GetInstance() );

  std::cout<<"Testing mitk::BaseRenderer::SetData()"<<std::endl;

  renderer->SetDataStorage(ds);

  std::cout<<"[TEST DONE]"<<std::endl;

  renWin->Delete();

  return EXIT_SUCCESS;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines