Commit e53212d9 authored by cfouard's avatar cfouard
Browse files

FIXED Replaced the Component needed by ReorientImage Action by

- an ImageOrientationHelper class in the core library to handle possible image orientations and transformations between these orientations
- some Geometry displayed in the action internal viewer

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1580 ec899d31-69d1-42ba-9299-647d76f65fb3
parent d773164f
......@@ -221,6 +221,18 @@ void ReorientImage::modelChanged(bool displayMaleModel)
}
// --------------- destructor -------------------
ReorientImage::~ReorientImage() {
internalViewer->getRendererWidget()->removeProp(femaleModel->getActor(InterfaceGeometry::Surface));
internalViewer->getRendererWidget()->removeProp(maleModel->getActor(InterfaceGeometry::Surface));
internalViewer->getRendererWidget()->removeProp(modelBoundingBox->getActor(InterfaceGeometry::Wireframe));
internalViewer->getRendererWidget()->removeProp(axes);
internalViewer->getRendererWidget()->removeProp(annotatedCube);
axes = NULL;
annotatedCube = NULL;
modelBoundingBox = NULL;
femaleModel = NULL;
maleModel = NULL;
if (dialog != NULL) {
delete dialog;
}
......
camitk_extension( COMPONENT_EXTENSION
DEFINES COMPILE_IMAGEORIENTATION_COMPONENT_API
NEEDS_COMPONENT_EXTENSION vtkmesh
INSTALL_ALL_HEADERS
)
This diff is collapsed.
#ifndef IMAGEORIENTATION_H
#define IMAGEORIENTATION_H
#include <QObject>
#include <Component.h>
#include <vtkSmartPointer.h>
#include <vtkAxesActor.h>
#include <vtkAnnotatedCubeActor.h>
#include <ImageOrientationHelper.h>
#include "ImageOrientationAPI.h"
namespace camitk {
class Property;
class MeshComponent;
class InteractiveViewer;
}
class IMAGEORIENTATION_API ImageOrientation : public camitk::Component {
Q_OBJECT
public:
/**
* Display either male of female model for orientation
*/
enum PossibleModels {
MALE,
FEMALE,
};
Q_ENUMS(PossibleModels)
/**
* For each axis (x, y or z), 6 possibilities:
* - Right (of th patient) to left (of the patient) [R]
* - Left (of th patient) to right (of th patient) [L]
* - Anterior (face) to Posterior (back) [A]
* - Posterior (back) to Anterior (face) [P]
* - Inferior (feet) to Superior (head) [I]
* - Superior (head) to Inferior (feet) [S]
*
* So 6 possibilities for x, 4 for y and 2 for z -> 48 possibilities
* 24 direct and 24 indirect.
enum PossibleImageOrientations {
// Direct Orientations
RAI,
RPS,
RIP,
RSA,
LAS,
LPI,
LIA,
ARS,
ALI,
AIR,
ASL,
PRI,
PLS,
PIL,
PSR,
IRA,
ILP,
IAL,
IPR,
SRP,
SLA,
SAR,
SPL,
};
Q_ENUMS(PossibleImageOrientations)
static vtkSmartPointer<vtkTransform> getTransformFromRAI(PossibleImageOrientations orientation, double dimX, double dimY, double dimZ);
static vtkSmartPointer<vtkTransform> getTransformToRAI(PossibleImageOrientations orientation, double dimX, double dimY, double dimZ);
*/
/// Default Constructor
ImageOrientation();
/// Default Destructor
virtual ~ImageOrientation();
virtual void initRepresentation();
virtual void updateProperty(QString name, QVariant value);
virtual void changeVisibility(camitk::InteractiveViewer * Viewer, bool visibility);
protected:
virtual void buildProperties();
virtual void buildAxes();
virtual void buildCube();
virtual void buildTransforms();
virtual void buildSubMeshes();
virtual void removeModel();
virtual void setModel(PossibleModels model);
// virtual void setImageOrientation(PossibleImageOrientations orientation);
virtual void setImageOrientation(camitk::ImageOrientationHelper::PossibleImageOrientations orientation);
camitk::Property * imageOrientation;
camitk::Property * model;
/// axes actor
vtkSmartPointer<vtkAxesActor> axes;
/// annotated cube actor
vtkSmartPointer<vtkAnnotatedCubeActor> annotatedCube;
vtkSmartPointer<vtkTransform> orientationTransform;
// The cube should not rotate, just translate...
vtkSmartPointer<vtkTransform> orientationCubeTransform;
vtkSmartPointer<vtkTransform> cubeTransform;
vtkSmartPointer<vtkTransform> axesTransform;
};
#endif // AXESREPRESENTATION_H
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// ----- ImageOrientationAPI.h
#ifndef IMAGEORIENTATION_API_H
#define IMAGEORIENTATION_API_H
// -----------------------------------------------------------------------
//
// IMAGEORIENTATION_API_H
//
// -----------------------------------------------------------------------
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the COMPILE_CAMITK_API
// flag defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// CAMITK_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#if defined(_WIN32) // MSVC and mingw
#ifdef COMPILE_IMAGEORIENTATION_COMPONENT_API
#define IMAGEORIENTATION_API __declspec(dllexport)
#else
#define IMAGEORIENTATION_API __declspec(dllimport)
#endif
#else
// for all other platforms CAMITK_API is defined to be "nothing"
#ifndef IMAGEORIENTATION_API
#define IMAGEORIENTATION_API
#endif
#endif // MSVC and mingw
// -----------------------------------------------------------------------
// It seems that MSVC does not understand exception specification
// If I understand it well, when _declspec() is used, there is a default
// nothrow attribute.
// I did not find the throw attribute. It seems that msvc is therefore ignoring the
// specification of the type of the exception.
// The compiler therefore issues a warning.
// The following line is to avoid this particular warning.
// The best would be to ask msvc not only to take the exception into account, but also
// its type. Anyway, I did not find how to do that anywhere, and I am not sure this is
// possible...
#if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
#pragma warning( disable : 4290 )
#endif // MSVC only
#endif // IMAGEORIENTATION_API_H
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2012 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "ImageOrientationExtension.h"
// include generated components headers
#include "ImageOrientation.h"
#include <Application.h>
#include <MeshComponent.h>
using namespace camitk;
// --------------- Extension Declaration -------------------
Q_EXPORT_PLUGIN2(imageorientationextension, ImageOrientationExtension);
// --------------- GetFileExtensions -------------------
QStringList ImageOrientationExtension::getFileExtensions() const {
QStringList ext;
ext << "axe";
return ext;
}
// --------------- Open -------------------
Component * ImageOrientationExtension::open(const QString & fileName) throw (AbortException) {
return new ImageOrientation();
}
// --------------- Save --------------------
bool ImageOrientationExtension::save(Component * component) const {
// depending on the components managed by FrameExtension, use
// component->getPointSet() (for a MeshComponent derived class)
// or component->getImageData() (for a ImageComponent derived class)
// and save the data in the managed format in the file component->getFileName()
return false;
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2012 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef IMAGEORIENTATIONEXTENSION_H
#define IMAGEORIENTATIONEXTENSION_H
#include <QObject>
#include<ComponentExtension.h>
class ImageOrientationExtension : public camitk::ComponentExtension {
Q_OBJECT
Q_INTERFACES(camitk::ComponentExtension);
public:
/// Constructor
ImageOrientationExtension() : camitk::ComponentExtension() {};
/// Method returning the component extension name
virtual QString getName() const {return "Axes Representation Extension ";};
/// Method returning the component extension descrption
virtual QString getDescription() const {return "This extension allows represent RAI, RLS, etc. axes.";};
/** Get the list of managed extensions
* (each file with an extension in the list can be loaded by this extension)
*/
virtual QStringList getFileExtensions() const;
/** Get a new instance from data stored in a file
* (this is the most important method to redefine in your subclass)
*/
virtual camitk::Component * open(const QString &) throw (camitk::AbortException);
/** Save a given Component (does not have to be top-level)
* into one of the currently managed format.
* @return false if the operation was not performed properly or not performed at all.
*/
virtual bool save(camitk::Component * component) const;
protected:
/// Destructor
virtual ~ImageOrientationExtension() {};
};
#endif // AXESREPRESENTATIONEXTENSION
// This is an empty test file to test AxesRepresentation Component
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment