diff --git a/Core/Code/Interactions/mitkEventRecorder.cpp b/Core/Code/Interactions/mitkEventRecorder.cpp
index 7421412fb7..04f9f2d8a2 100644
--- a/Core/Code/Interactions/mitkEventRecorder.cpp
+++ b/Core/Code/Interactions/mitkEventRecorder.cpp
@@ -1,164 +1,172 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkEventRecorder.h"
#include "mitkEventFactory.h"
#include "mitkInteractionEvent.h"
#include "mitkInteractionEventConst.h"
#include "mitkBaseRenderer.h"
static void WriteEventXMLHeader(std::ofstream& stream)
{
stream << mitk::InteractionEventConst::xmlHead() << "\n";
}
static void WriteEventXMLConfig(std::ofstream& stream)
{
//
stream << " <" << mitk::InteractionEventConst::xmlTagConfigRoot() << ">\n";
//write renderer config
//for all registered 2D renderers write name and viewdirection.
mitk::BaseRenderer::BaseRendererMapType::iterator rendererIterator = mitk::BaseRenderer::baseRendererMap.begin();
mitk::BaseRenderer::BaseRendererMapType::iterator end = mitk::BaseRenderer::baseRendererMap.end();
for(; rendererIterator != end; rendererIterator++)
{
std::string rendererName = (*rendererIterator).second->GetName();
+
mitk::SliceNavigationController::ViewDirection viewDirection = (*rendererIterator).second->GetSliceNavigationController()->GetDefaultViewDirection();
mitk::BaseRenderer::MapperSlotId mapperID = (*rendererIterator).second->GetMapperID();
- //
- stream << " <" << mitk::InteractionEventConst::xmlTagRenderer() << " " << mitk::InteractionEventConst::xmlEventPropertyRendererName() << "=\"" << rendererName << "\" " << mitk::InteractionEventConst::xmlEventPropertyViewDirection() << "=\"" << viewDirection << "\" " << mitk::InteractionEventConst::xmlEventPropertyMapperID() << "=\"" << mapperID << "\"/>\n";
+ //
+ stream << " <" << mitk::InteractionEventConst::xmlTagRenderer() << " "
+ << mitk::InteractionEventConst::xmlEventPropertyRendererName() << "=\""<< rendererName << "\" "
+ << mitk::InteractionEventConst::xmlEventPropertyViewDirection() << "=\""<< viewDirection << "\" "
+ << mitk::InteractionEventConst::xmlEventPropertyMapperID() << "=\"" << mapperID << "\" "
+ << mitk::InteractionEventConst::xmlRenderSizeX() << "=\"" << (*rendererIterator).second->GetSize()[0] << "\" "
+ << mitk::InteractionEventConst::xmlRenderSizeY() << "=\"" << (*rendererIterator).second->GetSize()[1] << "\" "
+ << mitk::InteractionEventConst::xmlRenderSizeZ() << "=\"" << (*rendererIterator).second->GetSize()[2] << "\" "
+ << "/>\n";
}
//
stream << " " << mitk::InteractionEventConst::xmlTagConfigRoot() << ">\n";
}
static void WriteEventXMLEventsOpen(std::ofstream& stream)
{
stream << " <" << mitk::InteractionEventConst::xmlTagEvents() << ">\n";
}
static void WriteEventXMLEventsClose(std::ofstream& stream)
{
stream << " " << mitk::InteractionEventConst::xmlTagEvents() << ">\n";
}
static void WriteEventXMLInteractionsOpen(std::ofstream& stream)
{
stream << "<" << mitk::InteractionEventConst::xmlTagInteractions() << ">\n";
}
static void WriteEventXMLInteractionsClose(std::ofstream& stream)
{
stream << "" << mitk::InteractionEventConst::xmlTagInteractions() << ">";
}
static void WriteEventXMLClose(std::ofstream& stream)
{
WriteEventXMLEventsClose(stream);
WriteEventXMLInteractionsClose(stream);
}
mitk::EventRecorder::EventRecorder()
: m_Active(false)
{
}
mitk::EventRecorder::~EventRecorder()
{
if (m_FileStream.is_open())
{
m_FileStream.flush();
m_FileStream.close();
}
}
void mitk::EventRecorder::Notify(mitk::InteractionEvent *interactionEvent, bool /*isHandled*/)
{
std::cout << EventFactory::EventToXML(interactionEvent) << "\n";
if (m_FileStream.is_open())
m_FileStream << EventFactory::EventToXML(interactionEvent) << "\n";
}
void mitk::EventRecorder::SetEventIgnoreList(std::vector list)
{
m_IgnoreList = list;
}
void mitk::EventRecorder::StartRecording()
{
if (m_FileName == "")
{
MITK_ERROR << "EventRecorder::StartRecording - Filename needs to be set first.";
return;
}
if (m_FileStream.is_open())
{
MITK_ERROR << "EventRecorder::StartRecording - Still recording. Stop recording before starting it again.";
return;
}
m_FileStream.open(m_FileName.c_str(), std::ofstream::out );
if ( !m_FileStream.good() )
{
MITK_ERROR << "File " << m_FileName << " could not be opened!";
m_FileStream.close();
return;
}
m_Active = true;
//write head and config
//
//
//
//
//
// ...
//
//
WriteEventXMLHeader(m_FileStream);
WriteEventXMLInteractionsOpen(m_FileStream);
WriteEventXMLConfig(m_FileStream);
WriteEventXMLEventsOpen(m_FileStream);
}
void mitk::EventRecorder::StopRecording()
{
if (m_FileStream.is_open())
{
//write end tag
//
//
WriteEventXMLClose(m_FileStream);
m_FileStream.flush();
m_FileStream.close();
m_Active =false;
}
}
diff --git a/Core/Code/Interactions/mitkInteractionEventConst.cpp b/Core/Code/Interactions/mitkInteractionEventConst.cpp
index a61354c688..7615c30aaf 100644
--- a/Core/Code/Interactions/mitkInteractionEventConst.cpp
+++ b/Core/Code/Interactions/mitkInteractionEventConst.cpp
@@ -1,165 +1,183 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkInteractionEventConst.h"
namespace mitk {
const std::string InteractionEventConst::xmlHead()
{
static const std::string xmlHead = "";
return xmlHead;
}
const std::string InteractionEventConst::xmlTagConfigRoot()
{
static const std::string xmlTagConfigRoot = "config";
return xmlTagConfigRoot;
}
const std::string InteractionEventConst::xmlTagEvents()
{
static const std::string xmlTagEvents = "events";
return xmlTagEvents;
}
const std::string InteractionEventConst::xmlTagInteractions()
{
static const std::string xmlTagInteractions = "interactions";
return xmlTagInteractions;
}
const std::string InteractionEventConst::xmlTagRenderer()
{
static const std::string xmlTagRenderer = "renderer";
return xmlTagRenderer;
}
const std::string InteractionEventConst::xmlTagParam()
{
static const std::string xmlTagParam = "param";
return xmlTagParam;
}
const std::string InteractionEventConst::xmlTagEventVariant()
{
static const std::string xmlTagEventVariant = "event_variant";
return xmlTagEventVariant;
}
const std::string InteractionEventConst::xmlTagAttribute()
{
static const std::string xmlTagAttribute = "attribute";
return xmlTagAttribute;
}
const std::string InteractionEventConst::xmlParameterName()
{
static const std::string xmlParameterName = "name";
return xmlParameterName;
}
const std::string InteractionEventConst::xmlParameterValue()
{
static const std::string xmlParameterValue = "value";
return xmlParameterValue;
}
const std::string InteractionEventConst::xmlParameterEventVariant()
{
static const std::string xmlParameterEventVariant = "event_variant";
return xmlParameterEventVariant;
}
const std::string InteractionEventConst::xmlParameterEventClass()
{
static const std::string xmlParameterEventClass = "class";
return xmlParameterEventClass;
}
const std::string InteractionEventConst::xmlEventPropertyModifier()
{
static const std::string xmlEventPropertyModifier = "Modifiers";
return xmlEventPropertyModifier;
}
const std::string InteractionEventConst::xmlEventPropertyEventButton()
{
static const std::string xmlEventPropertyEventButton = "EventButton";
return xmlEventPropertyEventButton;
}
const std::string InteractionEventConst::xmlEventPropertyButtonState()
{
static const std::string xmlEventPropertyButtonState = "ButtonState";
return xmlEventPropertyButtonState;
}
const std::string InteractionEventConst::xmlEventPropertyPositionInWorld()
{
static const std::string xmlEventPropertyPosition = "PositionInWorld";
return xmlEventPropertyPosition;
}
const std::string InteractionEventConst::xmlEventPropertyPositionOnScreen()
{
static const std::string xmlEventPropertyPosition = "PositionOnScreen";
return xmlEventPropertyPosition;
}
const std::string InteractionEventConst::xmlEventPropertyKey()
{
static const std::string xmlEventPropertyKey = "Key";
return xmlEventPropertyKey;
}
const std::string InteractionEventConst::xmlEventPropertyScrollDirection()
{
static const std::string xmlEventPropertyScrollDirection = "ScrollDirection";
return xmlEventPropertyScrollDirection;
}
const std::string InteractionEventConst::xmlEventPropertyWheelDelta()
{
static const std::string xmlEventPropertyWheelDelta = "WheelDelta";
return xmlEventPropertyWheelDelta;
}
const std::string InteractionEventConst::xmlEventPropertySignalName()
{
static const std::string xmlEventPropertySignalName = "SignalName";
return xmlEventPropertySignalName;
}
const std::string InteractionEventConst::xmlEventPropertyRendererName()
{
static const std::string xmlEventPropertyRendererName = "RendererName";
return xmlEventPropertyRendererName;
}
const std::string InteractionEventConst::xmlEventPropertyViewDirection()
{
static const std::string xmlEventPropertyViewDirection = "ViewDirection";
return xmlEventPropertyViewDirection;
}
const std::string InteractionEventConst::xmlEventPropertyMapperID()
{
static const std::string xmlEventPropertyMapperID = "MapperID";
return xmlEventPropertyMapperID;
}
+const std::string mitk::InteractionEventConst::xmlRenderSizeX()
+{
+ static const std::string xmlSize = "RenderSizeX";
+ return xmlSize;
+}
+
+const std::string mitk::InteractionEventConst::xmlRenderSizeY()
+{
+ static const std::string xmlSize = "RenderSizeY";
+ return xmlSize;
+}
+
+const std::string mitk::InteractionEventConst::xmlRenderSizeZ()
+{
+ static const std::string xmlSize = "RenderSizeZ";
+ return xmlSize;
+}
+
}
diff --git a/Core/Code/Interactions/mitkInteractionEventConst.h b/Core/Code/Interactions/mitkInteractionEventConst.h
index 02589cac20..137aaf0552 100644
--- a/Core/Code/Interactions/mitkInteractionEventConst.h
+++ b/Core/Code/Interactions/mitkInteractionEventConst.h
@@ -1,64 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKINTERACTEVENTCONST_H
#define MITKINTERACTEVENTCONST_H
#include
#include
namespace mitk
{
/**
* @brief Constants to describe Mouse Events and special Key Events.
*/
struct MITK_CORE_EXPORT InteractionEventConst
{
static const std::string xmlHead(); // = "";
// XML Tags
static const std::string xmlTagConfigRoot(); // = "config";
static const std::string xmlTagEvents(); // = "events";
static const std::string xmlTagInteractions(); // = "interactions";
static const std::string xmlTagParam(); // = "param";
static const std::string xmlTagEventVariant(); // = "event_variant";
static const std::string xmlTagAttribute(); // = "attribute";
static const std::string xmlTagRenderer(); // = "renderer";
// XML Param
static const std::string xmlParameterName(); // = "name";
static const std::string xmlParameterValue(); // = "value";
static const std::string xmlParameterEventVariant(); // = "event_variant";
static const std::string xmlParameterEventClass(); // = "class";
// Event Description
static const std::string xmlEventPropertyModifier(); // = "Modifiers";
static const std::string xmlEventPropertyEventButton(); // = "EventButton";
static const std::string xmlEventPropertyButtonState(); // = "ButtonState";
static const std::string xmlEventPropertyPositionInWorld(); // = "PositionInWorld";
static const std::string xmlEventPropertyPositionOnScreen(); // = "PositionOnScreen";
static const std::string xmlEventPropertyKey(); // = "Key";
static const std::string xmlEventPropertyScrollDirection(); // = "ScrollDirection";
static const std::string xmlEventPropertyWheelDelta(); // = "WheelDelta";
static const std::string xmlEventPropertySignalName(); // = "SignalName";
static const std::string xmlEventPropertyRendererName(); // = "RendererName";
static const std::string xmlEventPropertyViewDirection(); // = "ViewDirection";
static const std::string xmlEventPropertyMapperID(); // = "MapperID";
+
+ static const std::string xmlRenderSizeX(); // = "RenderSizeX";
+ static const std::string xmlRenderSizeY(); // = "RenderSizeY";
+ static const std::string xmlRenderSizeZ(); // = "RenderSizeZ";
};
} //namespace mitk
#endif //ifndef MITKINTERACTEVENTCONST_H
diff --git a/Core/Code/TestingHelper/mitkInteractionTestHelper.cpp b/Core/Code/TestingHelper/mitkInteractionTestHelper.cpp
index d4529dbf39..d2c65d5136 100644
--- a/Core/Code/TestingHelper/mitkInteractionTestHelper.cpp
+++ b/Core/Code/TestingHelper/mitkInteractionTestHelper.cpp
@@ -1,222 +1,242 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
//MITK
#include
#include
#include
#include
#include
//us
#include
#include
mitk::InteractionTestHelper::InteractionTestHelper(const std::string &interactionXmlFilePath)
: m_InteractionFilePath(interactionXmlFilePath)
{
this->Initialize(interactionXmlFilePath);
}
void mitk::InteractionTestHelper::Initialize(const std::string &interactionXmlFilePath)
{
//TiXmlDocument document(interactionXmlPath.c_str());
TiXmlDocument document(interactionXmlFilePath);
bool loadOkay = document.LoadFile();
if (loadOkay)
{
// Global interaction must(!) be initialized
if(! mitk::GlobalInteraction::GetInstance()->IsInitialized())
mitk::GlobalInteraction::GetInstance()->Initialize("global");
//get RenderingManager instance
mitk::RenderingManager* rm = mitk::RenderingManager::GetInstance();
//create data storage
m_DataStorage = mitk::StandaloneDataStorage::New();
//for each renderer found create a render window and configure
for( TiXmlElement* element = document.FirstChildElement(mitk::InteractionEventConst::xmlTagInteractions())->FirstChildElement(mitk::InteractionEventConst::xmlTagConfigRoot())->FirstChildElement(mitk::InteractionEventConst::xmlTagRenderer());
element != NULL;
element = element->NextSiblingElement(mitk::InteractionEventConst::xmlTagRenderer()) )
{
//get name of renderer
const char* rendererName = element->Attribute(mitk::InteractionEventConst::xmlEventPropertyRendererName().c_str());
//get view direction
mitk::SliceNavigationController::ViewDirection viewDirection = mitk::SliceNavigationController::Axial;
if(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyViewDirection()) != NULL)
{
int viewDirectionNum = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyViewDirection())->c_str());
viewDirection = static_cast(viewDirectionNum);
}
//get mapper slot id
mitk::BaseRenderer::MapperSlotId mapperID = mitk::BaseRenderer::Standard2D;
if(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyMapperID()) != NULL)
{
int mapperIDNum = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyMapperID())->c_str());
mapperID = static_cast(mapperIDNum);
}
+
+ // Get Size of Render Windows
+ int size[3];
+ size[0]=size[1]=size[2]=0;
+ if(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeX()) != NULL)
+ {
+ size[0] = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeX())->c_str());
+ }
+ if(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeY()) != NULL)
+ {
+ size[1] = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeY())->c_str());
+ }
+ if(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeZ()) != NULL)
+ {
+ size[2] = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeZ())->c_str());
+ }
+
//create renderWindow, renderer and dispatcher
mitk::RenderWindow::Pointer rw = mitk::RenderWindow::New(NULL, rendererName, rm); //VtkRenderWindow is created within constructor if NULL
+ if (size[0] != 0 && size[1] != 0)
+ rw->SetSize(size[0],size[1]);
+
//set storage of renderer
rw->GetRenderer()->SetDataStorage(m_DataStorage);
//set view direction to axial
rw->GetSliceNavigationController()->SetDefaultViewDirection( viewDirection );
//set renderer to render 2D
rw->GetRenderer()->SetMapperID(mapperID);
//connect SliceNavigationControllers to timestep changed event of TimeNavigationController
rw->GetSliceNavigationController()->ConnectGeometryTimeEvent(rm->GetTimeNavigationController(), false);
rm->GetTimeNavigationController()->ConnectGeometryTimeEvent(rw->GetSliceNavigationController(), false);
//add to list of kown render windows
m_RenderWindowList.push_back(rw);
}
//TODO: check the following lines taken from QmitkStdMultiWidget and adapt them to be executed in our code here.
// mitkWidget1->GetSliceNavigationController()
// ->ConnectGeometrySendEvent(mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()));
//########### register display interactor to handle scroll events ##################
//use MouseModeSwitcher to ensure that the statemachine of DisplayInteractor is loaded correctly
m_MouseModeSwitcher = mitk::MouseModeSwitcher::New();
}
else
{
mitkThrow() << "Can not load interaction xml file <" << m_InteractionFilePath << ">";
}
}
mitk::InteractionTestHelper::~InteractionTestHelper()
{
mitk::RenderingManager* rm = mitk::RenderingManager::GetInstance();
//unregister renderers
InteractionTestHelper::RenderWindowListType::iterator it = m_RenderWindowList.begin();
InteractionTestHelper::RenderWindowListType::iterator end = m_RenderWindowList.end();
for(; it != end; it++)
{
rm->GetTimeNavigationController()->Disconnect((*it)->GetSliceNavigationController());
(*it)->GetSliceNavigationController()->Disconnect(rm->GetTimeNavigationController());
mitk::BaseRenderer::RemoveInstance((*it)->GetVtkRenderWindow());
}
rm->RemoveAllObservers();
}
mitk::DataStorage::Pointer mitk::InteractionTestHelper::GetDataStorage()
{
return m_DataStorage;
}
void mitk::InteractionTestHelper::AddNodeToStorage(mitk::DataNode::Pointer node)
{
this->m_DataStorage->Add(node);
mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(m_DataStorage);
}
void mitk::InteractionTestHelper::PlaybackInteraction()
{
//load events if not loaded yet
if(m_Events.empty())
this->LoadInteraction();
//playback all events in queue
for (unsigned long i=0; i < m_Events.size(); ++i)
{
//let dispatcher of sending renderer process the event
m_Events.at(i)->GetSender()->GetDispatcher()->ProcessEvent(m_Events.at(i));
}
}
void mitk::InteractionTestHelper::LoadInteraction()
{
//load interaction pattern from xml file
std::ifstream xmlStream(m_InteractionFilePath.c_str());
mitk::XML2EventParser parser(xmlStream);
m_Events = parser.GetInteractions();
xmlStream.close();
// Avoid VTK warning: Trying to delete object with non-zero reference count.
parser.SetReferenceCount(0);
}
void mitk::InteractionTestHelper::SetTimeStep(int newTimeStep)
{
bool timeStepIsvalid = mitk::RenderingManager::GetInstance()->GetTimeNavigationController()->GetCreatedWorldGeometry()->IsValidTimeStep(newTimeStep);
if(timeStepIsvalid)
{
mitk::RenderingManager::GetInstance()->GetTimeNavigationController()->GetTime()->SetPos(newTimeStep);
}
}
mitk::RenderWindow* mitk::InteractionTestHelper::GetRenderWindowByName(const std::string &name)
{
InteractionTestHelper::RenderWindowListType::iterator it = m_RenderWindowList.begin();
InteractionTestHelper::RenderWindowListType::iterator end = m_RenderWindowList.end();
for(; it != end; it++)
{
if( name.compare( (*it)->GetRenderer()->GetName() ) == 0)
return (*it).GetPointer();
}
return NULL;
}
mitk::RenderWindow* mitk::InteractionTestHelper::GetRenderWindowByDefaultViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
{
InteractionTestHelper::RenderWindowListType::iterator it = m_RenderWindowList.begin();
InteractionTestHelper::RenderWindowListType::iterator end = m_RenderWindowList.end();
for(; it != end; it++)
{
if( viewDirection == (*it)->GetSliceNavigationController()->GetDefaultViewDirection() )
return (*it).GetPointer();
}
return NULL;
}
mitk::RenderWindow* mitk::InteractionTestHelper::GetRenderWindow(unsigned int index)
{
if( index < m_RenderWindowList.size() )
{
return m_RenderWindowList.at(index).GetPointer();
}
else
{
return NULL;
}
}
diff --git a/Modules/PlanarFigure/Testing/mitkPlanarFigureInteractionTest.cpp b/Modules/PlanarFigure/Testing/mitkPlanarFigureInteractionTest.cpp
index e60b773e72..af74aea5c4 100644
--- a/Modules/PlanarFigure/Testing/mitkPlanarFigureInteractionTest.cpp
+++ b/Modules/PlanarFigure/Testing/mitkPlanarFigureInteractionTest.cpp
@@ -1,219 +1,191 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
+#include
#include
#include
#include
#include "usModuleRegistry.h"
class mitkPlanarFigureInteractionTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPlanarFigureInteractionTestSuite);
-MITK_TEST(AngleInteractionCreate);
- // MITK_TEST(ArrowInteractionCreate);
-//MITK_TEST(BezierCurveInteractionCreate);
-MITK_TEST(CircleInteractionCreate);
- // MITK_TEST(CrossInteractionCreate);
-//MITK_TEST(DoubleEllipseInteractionCreate);
- //MITK_TEST(EllipseInteractionCreate);
-
-// MITK_TEST(PlanarFourPointAngleInteractionCreate);
-// MITK_TEST(PlanarLineInteractionCreate);
-// MITK_TEST(PlanarPolygonInteractionCreate);
+ MITK_TEST(AngleInteractionCreate);
+ MITK_TEST(BezierCurveInteractionCreate);
+ MITK_TEST(CircleInteractionCreate);
+ MITK_TEST(DoubleEllipseInteractionCreate);
+ MITK_TEST(PlanarFourPointAngleInteractionCreate);
+ MITK_TEST(PlanarLineInteractionCreate);
+ MITK_TEST(PlanarPolygonInteractionCreate);
MITK_TEST(NonClosedPlanarPolygonInteractionCreate);
-// MITK_TEST(RectangleInteractionCreate);
-
+ MITK_TEST(RectangleInteractionCreate);
+ MITK_TEST(PlanarSubdivisionInteractionCreate);
CPPUNIT_TEST_SUITE_END();
public:
void setUp()
{
}
void tearDown()
{
}
void RunTest(mitk::PlanarFigure::Pointer figure, std::string interactionXmlPath, std::string referenceFigurePath)
{
mitk::DataNode::Pointer node;
mitk::PlanarFigureInteractor::Pointer figureInteractor;
//Create DataNode as a container for our PlanarFigure
node = mitk::DataNode::New();
node->SetData(figure);
mitk::InteractionTestHelper interactionTestHelper(GetTestDataFilePath(interactionXmlPath));
//Load a bounding image
//mitk::Image::Pointer testImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("Pic3D.nrrd"));
mitk::Image::Pointer testImage = mitk::IOUtil::LoadImage("/home/cweber/SSD-Data/Test/0011.dcm");
mitk::DataNode::Pointer dn = mitk::DataNode::New();
dn->SetData(testImage);
interactionTestHelper.AddNodeToStorage(dn);
interactionTestHelper.GetDataStorage()->Add(node, dn);
node->SetName("PLANAR FIGURE");
// set as selected
node->SetSelected(true);
node->AddProperty("selected", mitk::BoolProperty::New(true));
//Load state machine
figureInteractor = mitk::PlanarFigureInteractor::New();
us::Module* planarFigureModule = us::ModuleRegistry::GetModule("MitkPlanarFigure");
figureInteractor->LoadStateMachine("PlanarFigureInteraction.xml", planarFigureModule );
figureInteractor->SetEventConfig( "PlanarFigureConfig.xml", planarFigureModule );
figureInteractor->SetDataNode( node );
//Start Interaction
interactionTestHelper.PlaybackInteraction();
//Load reference PlanarFigure
mitk::PlanarFigureReader::Pointer reader = mitk::PlanarFigureReader::New();
reader->SetFileName(GetTestDataFilePath(referenceFigurePath));
reader->Update();
mitk::PlanarFigure::Pointer reference = reader->GetOutput(0);
-
- mitk::PlanarFigureWriter::Pointer writer = mitk::PlanarFigureWriter::New();
- writer->SetFileName("/home/cweber/SSD-Data/Test/beurk.pf");
- writer->SetInput(figure);
- writer->Update();
-
//Compare figures
MITK_ASSERT_EQUAL(figure, reference, "Compare figure with reference");
-
}
void AngleInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarAngle::New();
- //RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarAngle_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarAngle_Create.pf");
- RunTest(figure, "/home/cweber/SSD-Data/Test/Angle.xml", "/home/cweber/SSD-Data/Test/Angle.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Angle.xml", "InteractionTestData/ReferenceData/Angle.pf");
}
- // TODO:
- //void ArrowInteractionCreate()
- //{
- // mitk::PlanarFigure::Pointer figure;
- // figure = mitk::PlanarArrow::New();
- // RunTest(figure, "InteractionTestDaa/Interactions/PlanarFigureInteractor_PlanarArrow_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarArrow_Create.pf");
- //}
void BezierCurveInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarBezierCurve::New();
- RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarCircle_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarCircle_Create.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Bezier.xml", "InteractionTestData/ReferenceData/Bezier.pf");
}
void CircleInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarCircle::New();
- //RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarCircle_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarCircle_Create.pf");
- RunTest(figure, "/home/cweber/SSD-Data/Test/Circle.xml", "/home/cweber/SSD-Data/Test/Circle.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Circle.xml", "InteractionTestData/ReferenceData/Circle.pf");
}
- // TODO:
- //void CrossInteractionCreate()
- //{
- // mitk::PlanarFigure::Pointer figure;
- // figure = mitk::PlanarCross::New();
- // RunTest(figure, "InteractionTestDaa/Interactions/PlanarFigureInteractor_PlanarCross_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarCross_Create.pf");
- //}
-
void DoubleEllipseInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarDoubleEllipse::New();
- RunTest(figure, "InteractionTestData/InteraName is DifferentLength/Circumferencections/PlanarFigureInteractor_PlanarDoubleEllipse_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarDoubleEllipse_Create.pf");
+ RunTest(figure, "InteractionTestData/Interactions/DoubleEllipse.xml", "InteractionTestData/ReferenceData/DoubleEllipse.pf");
}
- void EllipseInteractionCreate()
+ void PlanarSubdivisionInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
- figure = mitk::PlanarEllipse::New();
- RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarEllipse_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarEllipse_Create.pf");
+ figure = mitk::PlanarSubdivisionPolygon::New();
+ RunTest(figure, "InteractionTestData/Interactions/SubDivision.xml", "InteractionTestData/ReferenceData/SubDivision.pf");
}
void PlanarFourPointAngleInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarFourPointAngle::New();
- RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarFourPointAngle_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarFourPointAngle_Create.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Planar4PointAngle.xml", "InteractionTestData/ReferenceData/Planar4PointAngle.pf");
}
void PlanarLineInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarLine::New();
- RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarLine_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarLine_Create.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Line.xml", "InteractionTestData/ReferenceData/Line.pf");
}
void PlanarPolygonInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarPolygon::New();
- RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarPolygon_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarPolygon_Create.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Polygon.xml", "InteractionTestData/ReferenceData/Polygon.pf");
}
void NonClosedPlanarPolygonInteractionCreate()
{
mitk::PlanarPolygon::Pointer figure;
figure = mitk::PlanarPolygon::New();
figure->ClosedOff();
- //RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_NonClosedPlanarPolygon_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_NonClosedPlanarPolygon_Create.pf");
- RunTest(figure.GetPointer(), "/home/cweber/SSD-Data/Test/Path.xml", "/home/cweber/SSD-Data/Test/Path.pf");
+ RunTest(figure.GetPointer(), "InteractionTestData/Interactions/Path.xml", "InteractionTestData/ReferenceData/Path.pf");
}
void RectangleInteractionCreate()
{
mitk::PlanarFigure::Pointer figure;
figure = mitk::PlanarRectangle::New();
- RunTest(figure, "InteractionTestData/Interactions/PlanarFigureInteractor_PlanarRectangle_Create.xml", "InteractionTestData/ReferenceData/PlanarFigureInteractor_PlanarRectangle_Create.pf");
+ RunTest(figure, "InteractionTestData/Interactions/Rectangle.xml", "InteractionTestData/ReferenceData/Rectangle.pf");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPlanarFigureInteraction)