Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 90ab67f4 authored by promayon's avatar promayon
Browse files

First public release of camitk code source.

WARNING: previous revisions are not available on this svn repository.
Check with project developer for previous revisions in TIMC private svn repository.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@3 ec899d31-69d1-42ba-9299-647d76f65fb3
parent fd205aee
#
# CamiTK CMakeLists
#
# WARNING!
# CamiTK macros (component_extension, application_extension...) use GLOB to collect a
# list of source files from your source tree, which means that if no CMakeLists.txt file changes
# when a new source file is added or removed to your project then the generated build system
# cannot know when to ask CMake to regenerate.
# => DO NOT FORGET to regenerate CMake in case you add/remove a source file to your project
# all CMake project names and variables should be in uppercase
project(CAMITK)
cmake_minimum_required(VERSION 2.6)
# Find Qt (Qt4 without Qt3 support!)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
set (QT_USE_QT3SUPPORT OFF)
# Find VTK
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
# Configure CamiTK
# update module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CAMITK_SOURCE_DIR}/cmake/modules)
# include CamiTK Internal Build environment
include(CamiTKInternalBuild)
# include CamiTK variables
include(CamiTKVariables)
# include CamiTK generic macros from CMAKE_MODULE_PATH directory
include(CamiTKMacros)
# include CamiTK log configuration
include(CamiTKLog)
# include CamiTK auto-documentation generation
include(CamiTKApiDoc)
# include CamiTK package generation
include(CamiTKPackaging)
add_subdirectory(tools)
add_subdirectory(core)
add_subdirectory(components)
add_subdirectory(modules)
add_subdirectory(actions)
add_subdirectory(applications) # needs to be put at the end
add_subdirectory(cmake) # rules for cmake install
\ No newline at end of file
CamiTK - Computer Assisted Medical Intervention ToolKit
Copyright (C) 2011 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\ No newline at end of file
Simply use cmake to compile these extensions.
- unpack this archive
- create a build directory (at the root or anywhere elese)
- run cmake (cmake-gui on linux), click on configure (choose the generator
depending on your plateform) and then click on generate
- open your project in your IDE or type make in the build directory
Check the website http://camitk.imag.fr for the latest news and update!
\ No newline at end of file
#
# DO NOT EDIT THIS FILE (unless you REALLY know what you are doing)
#
# To add a component, just add a subdirectory (the component name is the
# directory name). Add all your code there and a text file called
# CMakeLists.txt
# In your CMakeLists.txt, use the action_extension() macro apropriately
# find components
get_subdirectories(ACTIONS_LIST)
# Add subdirectories in CMake project
foreach(ACTION_NAME ${ACTIONS_LIST})
subdirs(${ACTION_NAME})
endforeach()
#
# DO NOT EDIT THIS FILE (unless you REALLY know what you are doing)
#
# To add a component, just add a subdirectory (the component name is the
# directory name). Add all your code there and a text file called
# CMakeLists.txt
# In your CMakeLists.txt, use the action_extension() macro apropriately
# find components
get_subdirectories(ACTIONS_IMAGE_LIST)
# Add subdirectories in CMake project
foreach(ACTION_IMAGE_NAME ${ACTIONS_IMAGE_LIST})
subdirs(${ACTION_IMAGE_NAME})
endforeach()
\ No newline at end of file
action_extension(DEFAULT
DEFINES COMPILE_LUT_ACTION_API)
\ No newline at end of file
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2011 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include <ImageComponent.h>
#include <Application.h>
#include "ImageLutAction.h"
#include "ImageLutWidget.h"
using namespace camitk;
// --------------- constructor -------------------
ImageLutAction::ImageLutAction(QString extensionName) : Action(extensionName) {
this->setName("Lut");
this->setDescription("Apply lut to image components.<br>(c)TIMC-IMAG 2003-2011");
this->setComponent("ImageComponent");
this->setFamily("ImageLut");
this->addTag("Lut");
this->setEmbedded(true);
this->setModal(false);
this->setDelayed(false);
}
QWidget * ImageLutAction::getWidget(ComponentList compList) {
Component * img = compList.last();
if (img->isInstanceOf("ImageComponent")) {
return new ImageLutWidget((ImageComponent *) img, Application::getMainWindow());
}
return NULL;
}
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2011 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef IMAGELUTACTION_H
#define IMAGELUTACTION_H
#include <QObject>
#include <Action.h>
using namespace camitk;
class ImageLutAction : public Action {
public:
/// the constructor
ImageLutAction(QString extensionName);
/// the destructor
virtual ~ImageLutAction() {};
/// the widget used with the action
virtual QWidget * getWidget(ComponentList compList);
private:
/// method applied when the action is call
virtual void apply(ComponentList compList) {};
};
#endif // IMAGELUTACTION_H
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2011 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include "ImageLutExtension.h"
#include "ImageLutAction.h"
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(imagelut, ImageLutxtension);
// --------------- getActions -------------------
void ImageLutxtension::load() {
new ImageLutAction(getName());
}
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2011 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef IMAGELUTEXTENSION_H
#define IMAGELUTEXTENSION_H
#include <ActionExtension.h>
using namespace camitk;
class ImageLutxtension : public ActionExtension {
Q_OBJECT
Q_INTERFACES(camitk::ActionExtension);
public:
/// the constructor
ImageLutxtension() : ActionExtension() {};
/// the destructor
virtual ~ImageLutxtension() {};
/// Method must be reimplemented when an ActionExtension is done,
/// the own actions of an extension are load there.
/// It is necessairy to use the method ActionManager::addAction(Action) for each action added in this method.
virtual void load();
/// Method that return the action extension name
virtual QString getName() {return "image lut";};
/// Method that return the action extension descrption
virtual QString getDescription() {return "extension use to get lut widget for image component";};
};
#endif // IMAGELUTEXTENSION_H
This diff is collapsed.
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2011 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef ImageLutWidget_H
#define ImageLutWidget_H
// -- stl stuff
#include <string>
#include <fstream>
#include <vector>
#include <sstream>
// -- QT stuff
#include <QListWidget>
#include <QLineEdit>
#include <QCheckBox>
#include <QMap>
#include <QPushButton>
#include <QGraphicsView>
#include <QGraphicsSimpleTextItem>
// -- vtk stuff
#include <vtkWindowLevelLookupTable.h>
#include <vtkSmartPointer.h>
// -- Camitk stuff
#include "ui_ImageLutWidget.h"
using namespace std;
// -- Core image component stuff classes
#include <ImageComponent.h>
// -- Core stuff classes
class InteractiveViewer;
using namespace camitk;
//***************************************************************************
/**
* The class ImageLutWidget defines a widget controling the properties of
* an instance of ImageComponent.
* As it has to update the 3D view and the plane views, it must declare 2
* signals : update3DView and updatePlaneView. These signals, if exist, are
* handle by the viewers and connected to the correct 3D/plane views. If the
* signals are not present in the Component widget then not updating is possible.
*
*/
class ImageLutWidget : public QWidget {
Q_OBJECT
public:
/** Default construtor */
ImageLutWidget(ImageComponent *, QWidget* parent = 0);
~ImageLutWidget();
///Method that initialize the lookup table histogram
void initHistogram();
/// TODO clean this hack
/// this is a hack: please reconsider the whole initialization process of this class (it seems a bit complex with lots of extra-bloated calls)
//bool interactiveRefresh();
//void setInteractiveRefresh(bool);
public slots:
/// Slot called when the slider lutlevel changed
virtual void sliderLutLevelChanged(int);
/// Slot called whe the line edit lut level changed
virtual void lineEditLutLevelChanged();
/// Slot that change the window width of the LUT
virtual void lineEditLutWindowChanged();
/// Slot that change the window width of the LUT
virtual void sliderLutWindowChanged(int);
/// Slot that change the palette color of the LUT
virtual void lutColorChanged();
/// Slot that invert LUT
virtual void lutInversion();
/// Slot that reset changed applied to the LUT
virtual void resetLut();
/// Update lut
void lutUpdate();
signals:
/// signals that ask the 3D view to be updated
void update3DView();
/// signals that ask the plane view to be updated
void updatePlaneView();
private:
/** Init a slider with its minimum, maximum and current value. */
void initSlider(QSlider *slider, int min, int max, int value);
///Method that initialize the lookup table histogram
void initHistogram(QGraphicsView *view);
///Draws the blue rectangle and the bin histogram
void drawGraphicScene( QGraphicsView *view );
template<class DATATYPE> void fillHistogramTable(DATATYPE * data, unsigned int dataDim,
DATATYPE minVal, DATATYPE maxVal);
// Image histogram
void setHistoLevelWindow();
// the ImageComponent
ImageComponent *myComponent;
vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable;
/// Min and max of the possible data value (given by the data type of the image)
double lutMin;
double lutMax;
QGraphicsScene * histogramScene;
QGraphicsLineItem * histo_lutLevel;
QGraphicsPolygonItem * histo_lutWindow;
QGraphicsSimpleTextItem * actualMinGreyLabel;
QGraphicsSimpleTextItem * actualMaxGreyLabel;
QGraphicsRectItem * bgRectangle;
/// Size of the histogram drawing ?
qreal histo_xmin;
qreal histo_ymin;
qreal histo_width;
qreal histo_height;
qreal total_histo_width;
qreal total_histo_height;
qreal x_axe_ylift;
// qreal x_axe_xlift;
/// Step for histogram drawing (histo_width / (realMax - realMin)
qreal dx;
// Table containing histogram bins
unsigned int * greyLevels;
// size of greyLevels
int nbHistoBins;
// width of bins
unsigned int intervalLength;
Ui::ui_ImageLutWidget ui;
};
//**************************************************************************
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ui_ImageLutWidget</class>
<widget class="QWidget" name="ui_ImageLutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>628</width>
<height>712</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Image Volume</string>
</property>
<property name="toolTip">
<string>Image Volume Property</string>
</property>
<property name="whatsThis">
<string>You can change here the propreties value of the Image
Volume data component...</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QGraphicsView" name="histogramGraphicsView"/>
</item>
<item>
<widget class="QGroupBox" name="lutGroupBox">
<property name="title">
<string>Lookup Table (LUT)</string>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="greyLevelLabel">
<property name="text">
<string>Window Level</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="lineEditLutLevel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>32767</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSlider" name="sliderLutLevel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>