-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
## ========================
## == Project definition ==
SUBDIRS(
bash
examples
+ PipelineEditor
)
## eof - $RCSfile$
--- /dev/null
+IF(Qt4_FOUND)
+ AppFromDir(_app_name ${CMAKE_CURRENT_SOURCE_DIR})
+ IF(_app_name)
+ TARGET_LINK_LIBRARIES(${_app_name} ${cpBaseQtApplication_LIB})
+ ENDIF(_app_name)
+ENDIF(Qt4_FOUND)
+
+## eof - $RCSfile$
--- /dev/null
+#include <appli/PipelineEditor/PipelineEditorMainWindow.h>
+#include <appli/PipelineEditor/ui_PipelineEditorMainWindow.h>
+
+// -------------------------------------------------------------------------
+PipelineEditorMainWindow::
+PipelineEditorMainWindow(
+ int argc, char* argv[], QApplication* app, QWidget* parent
+ )
+ : Superclass( argc, argv, app, parent ),
+ m_UI( new Ui::PipelineEditorMainWindow )
+{
+ // Basic UI configuration
+ this->m_UI->setupUi( this );
+ this->_configure(
+ this->m_UI->Navigator,
+ this->m_UI->MPR,
+ this->m_UI->Canvas->editor( )
+ );
+
+ // Slots <-> signals
+ cpBaseQtApplication_ConnectAction( ActionOpen, _loadWorkspace );
+ cpBaseQtApplication_ConnectAction( ActionSave, _saveWorkspace );
+ cpBaseQtApplication_ConnectAction( ActionShowPlugins, _showPlugins );
+ cpBaseQtApplication_ConnectAction( ActionAddEnvironmentPath, _addEnvironmentPaths );
+ cpBaseQtApplication_ConnectAction( ActionLoadPluginFile, _loadPlugins );
+ cpBaseQtApplication_ConnectAction( ActionLoadPluginDirectory, _loadPluginsFromPath );
+}
+
+// -------------------------------------------------------------------------
+PipelineEditorMainWindow::
+~PipelineEditorMainWindow( )
+{
+ delete this->m_UI;
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __PIPELINEEDITORMAINWINDOW__H__
+#define __PIPELINEEDITORMAINWINDOW__H__
+
+#include <cpBaseQtApplication/MainWindow.h>
+
+// -------------------------------------------------------------------------
+namespace Ui
+{
+ class PipelineEditorMainWindow;
+}
+
+/**
+ */
+class PipelineEditorMainWindow
+ : public cpBaseQtApplication::MainWindow
+{
+ Q_OBJECT;
+public:
+ typedef PipelineEditorMainWindow Self;
+ typedef cpBaseQtApplication::MainWindow Superclass;
+
+public:
+ explicit PipelineEditorMainWindow(
+ int argc, char* argv[],
+ QApplication* app,
+ QWidget* parent = NULL
+ );
+ virtual ~PipelineEditorMainWindow( );
+
+private:
+ Ui::PipelineEditorMainWindow* m_UI;
+};
+
+#endif // __PIPELINEEDITORMAINWINDOW__H__
+
+// eof - $RCSfile$
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PipelineEditorMainWindow</class>
+ <widget class="QMainWindow" name="PipelineEditorMainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="MainWindget">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="cpExtensions::QT::SimpleMPRWidget" name="MPR" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>60</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="cpBaseQtApplication::PluginsNavigator" name="Navigator">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>60</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="cpBaseQtApplication::Canvas" name="Canvas" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>60</height>
+ </size>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>&File</string>
+ </property>
+ <addaction name="ActionOpen"/>
+ <addaction name="ActionSave"/>
+ <addaction name="ActionClose"/>
+ <addaction name="separator"/>
+ <addaction name="ActionExit"/>
+ </widget>
+ <widget class="QMenu" name="menuPlugins">
+ <property name="title">
+ <string>&Plugins</string>
+ </property>
+ <addaction name="ActionLoadPluginFile"/>
+ <addaction name="ActionLoadPluginDirectory"/>
+ <addaction name="separator"/>
+ <addaction name="ActionShowPlugins"/>
+ <addaction name="ActionAddEnvironmentPath"/>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuPlugins"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="ActionOpen">
+ <property name="text">
+ <string>&Open</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action name="ActionSave">
+ <property name="text">
+ <string>&Save</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action name="ActionExit">
+ <property name="text">
+ <string>E&xit</string>
+ </property>
+ </action>
+ <action name="ActionClose">
+ <property name="text">
+ <string>&Close</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+C</string>
+ </property>
+ </action>
+ <action name="ActionLoadPluginFile">
+ <property name="text">
+ <string>Load &file</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+P</string>
+ </property>
+ </action>
+ <action name="ActionLoadPluginDirectory">
+ <property name="text">
+ <string>Load &directory</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+D</string>
+ </property>
+ </action>
+ <action name="ActionShowPlugins">
+ <property name="text">
+ <string>&Show</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+S</string>
+ </property>
+ </action>
+ <action name="ActionAddEnvironmentPath">
+ <property name="text">
+ <string>&Manage enviroment paths</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+F9</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>cpExtensions::QT::SimpleMPRWidget</class>
+ <extends>QWidget</extends>
+ <header location="global">cpExtensions/QT/SimpleMPRWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>cpBaseQtApplication::Canvas</class>
+ <extends>QWidget</extends>
+ <header location="global">cpBaseQtApplication/Canvas.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>cpBaseQtApplication::PluginsNavigator</class>
+ <extends>QTreeWidget</extends>
+ <header location="global">cpBaseQtApplication/PluginsNavigator.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>ActionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>PipelineEditorMainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>212</x>
+ <y>190</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+#include <cpBaseQtApplication/MainHelper.h>
+#include <appli/PipelineEditor/PipelineEditorMainWindow.h>
+
+cpBaseQtApplication_Main( PipelineEditorMainWindow );
+cpBaseQtApplication_MainComplement;
+
+// eof - $RCSfile$
## == Find cpPlugins-cmake tools ==
## ================================
-SET(
- _cmake_tools
- DetectOS
- Functions
- Restrictions
- KitwareTools
- )
IF("@Qt4_FOUND@" STREQUAL "TRUE")
SET(USE_QT4 ON)
- SET(
- _cmake_tools
- ${_cmake_tools}
- Qt4Tools
- )
ENDIF("@Qt4_FOUND@" STREQUAL "TRUE")
-FOREACH(_t ${_cmake_tools})
- SET(_tool "cpPlugins_${_t}.cmake")
- FIND_FILE(
- ${_tool}
- NAMES ${_tool}
- HINTS /usr/share/cmake /usr/local/share/cmake
- PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
- DOC "Where is \"${_tool}\"?"
- )
- IF(NOT ${_tool})
- MESSAGE(FATAL_ERROR "Where is \"${_tool}\"?")
- ENDIF(NOT ${_tool})
- MARK_AS_ADVANCED(FORCE ${_tool})
- INCLUDE(${${_tool}})
-ENDFOREACH(_t)
-
## ====================
## == Find libraries ==
## ====================
--- /dev/null
+#!/bin/bash
+
+## -------------------------------------------------------------------------
+function abspath()
+{
+ pushd . > /dev/null
+ if [ -d "$1" ]; then
+ cd "$1"
+ dirs -l +0
+ else
+ cd "`dirname \"$1\"`"
+ cur_dir=`dirs -l +0`
+ if [ "$cur_dir" == "/" ]; then
+ echo "$cur_dir`basename \"$1\"`"
+ else
+ echo "$cur_dir/`basename \"$1\"`"
+ fi
+ fi
+ popd > /dev/null
+}
+
+## -------------------------------------------------------------------------
+function get_file_extension
+{
+ valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
+ actual_file=`abspath $1`
+ actual_ext=""
+ for ext in ${valid_extensions[@]}; do
+ test_str=`dirname $actual_file`/`basename $actual_file $ext`
+ if [ $test_str != $actual_file ]; then
+ actual_ext=$ext
+ fi
+ done
+ echo "$actual_ext"
+}
+
+## -------------------------------------------------------------------------
+function print_help()
+{
+ echo "Usage: `basename $0` -f=compressed_code -c=source_dir -b=build_dir [-p=instalation_prefix] [-q=qmake_executable]"
+}
+
+## -------------------------------------------------------------------------
+## Analyze command-line arguments
+if [ $# -eq 0 ]; then
+ print_help
+ exit 1
+fi
+prefix="${HOME}/local"
+for i in "$@"; do
+ case $i in
+ -f=*|--file=*)
+ source_file="${i#*=}"
+ shift
+ ;;
+ -c=*|--source_dir=*)
+ source_dir="${i#*=}"
+ shift
+ ;;
+ -b=*|--build_dir=*)
+ build_dir="${i#*=}"
+ shift
+ ;;
+ -p=*|--prefix=*)
+ prefix="${i#*=}"
+ shift
+ ;;
+ -q=*|--qmake=*)
+ qmake_exec="${i#*=}"
+ shift
+ ;;
+ *)
+ ;;
+ esac
+done
+
+## Check command line arguments
+if [ "x$source_dir" == "x" ]; then
+ if [ "x$source_file" != "x" ]; then
+ base_path=`abspath $source_file`
+ base_ext=`get_file_extension $base_path`
+ base_dir=`dirname $base_path`
+ if [ "x$base_ext" != "x" ]; then
+ source_dir="$base_dir"/`basename $base_path .$base_ext`
+ else
+ echo "Error: Input compressed file extension not recognized."
+ exit 1
+ fi
+ else
+ print_help
+ exit 1
+ fi
+fi
+if [ "x$build_dir" == "x" ]; then
+ if [ "x$source_dir" != "x" ]; then
+ base_dir=$source_dir
+ if [ "${source_dir:$((${#str}-1)):1}" == "/" ]; then
+ base_dir=`echo $source_dir | rev | cut -c 2- | rev`
+ fi
+ build_dir="$base_dir-build"
+ else
+ print_help
+ exit 1
+ fi
+fi
+
+# Locate qmake executable
+if [ "x$qmake_exec" == "x" ]; then
+ qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+ for loc in ${qmake_locations[@]}; do
+ qmake_file="$loc/qmake"
+ if [ -x $qmake_file ]; then
+ version=`$qmake_file --version | grep Using\ Qt\ version | cut -d ' ' -f 4`
+ if [ "${version:0:3}" == "4.8" ]; then
+ qmake_exec=$qmake_file
+ fi
+ fi
+ done
+fi
+qmake_exec=`abspath $qmake_exec`
+if [ -x $qmake_exec ]; then
+ qt_options="--qt-gui --qt-qmake=$qmake_exec"
+else
+ qt_options="--no-qt-gui"
+fi
+
+## Other configuration variables
+platform=`uname`
+number_of_cores=`grep -c ^processor /proc/cpuinfo`
+number_of_threads=`expr $number_of_cores / 2`
+if [ "x$source_file" != "x" ]; then
+ source_file=`abspath $source_file`
+fi
+source_dir=`abspath $source_dir`
+build_dir=`abspath $build_dir`
+
+echo "====================================================================="
+echo "==> Source file : $source_file"
+echo "==> Source dir : $source_dir"
+echo "==> Build dir : $build_dir"
+echo "==> Prefix : $prefix"
+echo "==> qmake : $qmake_exec"
+echo "==> Qt options : $qt_options"
+echo "==> Platform : $platform"
+echo "==> Number of cores : $number_of_cores"
+echo "==> Number of threads : $number_of_threads"
+echo "====================================================================="
+read -n1 -r -p "Continue? [Y/N]... " key
+echo
+if [ "$key" != 'Y' -a "$key" != 'y' ] ; then
+ exit 1
+fi
+
+## Create paths
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Cleaning directories... "
+ rm -rf $source_dir
+ rm -rf $build_dir
+ echo "done."
+ echo -n "==> Creating directories... "
+ mkdir -p $source_dir
+ mkdir -p $build_dir
+ echo "done."
+fi
+
+## Extract source code
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Extracting sources... "
+ base_path=`abspath $source_file`
+ base_ext=`get_file_extension $base_path`
+ if [ "$base_ext" == "zip" ]; then
+ echo unzip $base_path
+ elif [ "$base_ext" == "tar" ]; then
+ tar xf $base_path -C $source_dir --strip-components=1
+ elif [ "$base_ext" == "tar.gz" ]; then
+ tar xzf $base_path -C $source_dir --strip-components=1
+ elif [ "$base_ext" == "tar.bz2" ]; then
+ tar xjf $base_path -C $source_dir --strip-components=1
+ fi
+ echo "done."
+fi
+
+echo "==> Configuring sources... "
+cd $build_dir
+$source_dir/bootstrap --prefix=$prefix $qt_options
+echo "==> Configuring sources... done."
+
+echo "==> Compiling sources..."
+cd $build_dir
+make -j$number_of_threads
+echo "==> Compiling sources... done."
+
+echo "==> Installing package..."
+cd $build_dir
+make -j install
+echo "==> Installing package... done."
+
+## eof - $RCSfile$
--- /dev/null
+#!/bin/bash
+
+## -------------------------------------------------------------------------
+function abspath()
+{
+ pushd . > /dev/null
+ if [ -d "$1" ]; then
+ cd "$1"
+ dirs -l +0
+ else
+ cd "`dirname \"$1\"`"
+ cur_dir=`dirs -l +0`
+ if [ "$cur_dir" == "/" ]; then
+ echo "$cur_dir`basename \"$1\"`"
+ else
+ echo "$cur_dir/`basename \"$1\"`"
+ fi
+ fi
+ popd > /dev/null
+}
+
+## -------------------------------------------------------------------------
+function get_file_extension
+{
+ valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
+ actual_file=`abspath $1`
+ actual_ext=""
+ for ext in ${valid_extensions[@]}; do
+ test_str=`dirname $actual_file`/`basename $actual_file $ext`
+ if [ $test_str != $actual_file ]; then
+ actual_ext=$ext
+ fi
+ done
+ echo "$actual_ext"
+}
+
+## -------------------------------------------------------------------------
+function print_help()
+{
+ echo "Usage: `basename $0` -f=compressed_code -c=source_dir -b=build_dir [-p=instalation_prefix] [-m=cmake_executable] [-t=build_type[MinSizeRel/Debug/Release]]"
+}
+
+## -------------------------------------------------------------------------
+## Analyze command-line arguments
+if [ $# -eq 0 ]; then
+ print_help
+ exit 1
+fi
+prefix="${HOME}/local"
+build_type="MinSizeRel"
+for i in "$@"; do
+ case $i in
+ -f=*|--file=*)
+ source_file="${i#*=}"
+ shift
+ ;;
+ -c=*|--source_dir=*)
+ source_dir="${i#*=}"
+ shift
+ ;;
+ -b=*|--build_dir=*)
+ build_dir="${i#*=}"
+ shift
+ ;;
+ -t=*|--build_type=*)
+ build_type="${i#*=}"
+ shift
+ ;;
+ -p=*|--prefix=*)
+ prefix="${i#*=}"
+ shift
+ ;;
+ -m=*|--cmake=*)
+ cmake_exec="${i#*=}"
+ shift
+ ;;
+ *)
+ ;;
+ esac
+done
+
+## Check command line arguments
+if [ "x$source_dir" == "x" ]; then
+ if [ "x$source_file" != "x" ]; then
+ base_path=`abspath $source_file`
+ base_ext=`get_file_extension $base_path`
+ base_dir=`dirname $base_path`
+ if [ "x$base_ext" != "x" ]; then
+ source_dir="$base_dir"/`basename $base_path .$base_ext`
+ else
+ echo "Error: Input compressed file extension not recognized."
+ exit 1
+ fi
+ else
+ print_help
+ exit 1
+ fi
+fi
+if [ "x$build_dir" == "x" ]; then
+ if [ "x$source_dir" != "x" ]; then
+ base_dir=$source_dir
+ if [ "${source_dir:$((${#str}-1)):1}" == "/" ]; then
+ base_dir=`echo $source_dir | rev | cut -c 2- | rev`
+ fi
+ build_dir="$base_dir-build"
+ else
+ print_help
+ exit 1
+ fi
+fi
+
+## Locate cmake executable
+if [ "x$cmake_exec" == "x" ]; then
+ cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+ cmake_ver=""
+ for loc in ${cmake_locations[@]}; do
+ cmake_file="$loc/cmake"
+ if [ -x $cmake_file ]; then
+ str=`$cmake_file --version | grep version`
+ version=${str:14}
+ if [ "$cmake_ver" \< "$version" ]; then
+ cmake_ver=$version
+ cmake_exec=$cmake_file
+ fi
+ fi
+ done
+fi
+if [ ! -x $cmake_exec ]; then
+ echo "ERROR: no valid cmake found."
+ exit 1
+fi
+cmake_exec=`abspath $cmake_exec`
+
+## Other configuration variables
+platform=`uname`
+number_of_cores=`grep -c ^processor /proc/cpuinfo`
+number_of_threads=`expr $number_of_cores / 2`
+if [ "x$source_file" != "x" ]; then
+ source_file=`abspath $source_file`
+fi
+source_dir=`abspath $source_dir`
+build_dir=`abspath $build_dir`
+
+echo "====================================================================="
+echo "==> Source file : $source_file"
+echo "==> Source dir : $source_dir"
+echo "==> Build dir : $build_dir"
+echo "==> Build type : $build_type"
+echo "==> Prefix : $prefix"
+echo "==> cmake : $cmake_exec"
+echo "==> Platform : $platform"
+echo "==> Number of cores : $number_of_cores"
+echo "==> Number of threads : $number_of_threads"
+echo "====================================================================="
+read -n1 -r -p "Continue? [Y/N]... " key
+echo
+if [ "$key" != 'Y' -a "$key" != 'y' ] ; then
+ exit 1
+fi
+
+## Create paths
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Cleaning directories... "
+ rm -rf $source_dir
+ rm -rf $build_dir
+ echo "done."
+ echo -n "==> Creating directories... "
+ mkdir -p $source_dir
+ mkdir -p $build_dir
+ echo "done."
+fi
+
+## Extract source code
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Extracting sources... "
+ base_path=`abspath $source_file`
+ base_ext=`get_file_extension $base_path`
+ if [ "$base_ext" == "zip" ]; then
+ echo unzip $base_path
+ elif [ "$base_ext" == "tar" ]; then
+ tar xf $base_path -C $source_dir --strip-components=1
+ elif [ "$base_ext" == "tar.gz" ]; then
+ tar xzf $base_path -C $source_dir --strip-components=1
+ elif [ "$base_ext" == "tar.bz2" ]; then
+ tar xjf $base_path -C $source_dir --strip-components=1
+ fi
+ echo "done."
+fi
+
+echo "==> Configuring sources... "
+cd $build_dir
+$cmake_exec \
+ -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
+ -DBUILD_DOCUMENTATION:BOOL=OFF \
+ -DBUILD_EXAMPLES:BOOL=OFF \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ -DBUILD_TESTING:BOOL=OFF \
+ -DCMAKE_BUILD_TYPE:STRING=$build_type \
+ -DModule_ITKReview:BOOL=ON \
+ -DModule_ITKVtkGlue:BOOL=OFF \
+ -DModule_ParabolicMorphology:BOOL=ON \
+ -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
+ ${source_dir}
+echo "==> Configuring sources... done."
+
+echo "==> Compiling sources..."
+cd $build_dir
+make -j$number_of_threads
+echo "==> Compiling sources... done."
+
+echo "==> Installing package..."
+cd $build_dir
+make -j install
+echo "==> Installing package... done."
+
+## eof - $RCSfile$
--- /dev/null
+#!/bin/bash
+
+## -------------------------------------------------------------------------
+function abspath()
+{
+ pushd . > /dev/null
+ if [ -d "$1" ]; then
+ cd "$1"
+ dirs -l +0
+ else
+ cd "`dirname \"$1\"`"
+ cur_dir=`dirs -l +0`
+ if [ "$cur_dir" == "/" ]; then
+ echo "$cur_dir`basename \"$1\"`"
+ else
+ echo "$cur_dir/`basename \"$1\"`"
+ fi
+ fi
+ popd > /dev/null
+}
+
+## -------------------------------------------------------------------------
+function get_file_extension
+{
+ valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
+ actual_file=`abspath $1`
+ actual_ext=""
+ for ext in ${valid_extensions[@]}; do
+ test_str=`dirname $actual_file`/`basename $actual_file $ext`
+ if [ $test_str != $actual_file ]; then
+ actual_ext=$ext
+ fi
+ done
+ echo "$actual_ext"
+}
+
+## -------------------------------------------------------------------------
+function print_help()
+{
+ echo "Usage: `basename $0` -f=compressed_code -c=source_dir -b=build_dir [-p=instalation_prefix] [-q=qmake_executable] [-m=cmake_executable] [-t=build_type[MinSizeRel/Debug/Release]]"
+}
+
+## -------------------------------------------------------------------------
+## Analyze command-line arguments
+if [ $# -eq 0 ]; then
+ print_help
+ exit 1
+fi
+prefix="${HOME}/local"
+build_type="MinSizeRel"
+for i in "$@"; do
+ case $i in
+ -f=*|--file=*)
+ source_file="${i#*=}"
+ shift
+ ;;
+ -c=*|--source_dir=*)
+ source_dir="${i#*=}"
+ shift
+ ;;
+ -b=*|--build_dir=*)
+ build_dir="${i#*=}"
+ shift
+ ;;
+ -t=*|--build_type=*)
+ build_type="${i#*=}"
+ shift
+ ;;
+ -p=*|--prefix=*)
+ prefix="${i#*=}"
+ shift
+ ;;
+ -m=*|--cmake=*)
+ cmake_exec="${i#*=}"
+ shift
+ ;;
+ -q=*|--qmake=*)
+ qmake_exec="${i#*=}"
+ shift
+ ;;
+ *)
+ ;;
+ esac
+done
+
+## Check command line arguments
+if [ "x$source_dir" == "x" ]; then
+ if [ "x$source_file" != "x" ]; then
+ base_path=`abspath $source_file`
+ base_ext=`get_file_extension $base_path`
+ base_dir=`dirname $base_path`
+ if [ "x$base_ext" != "x" ]; then
+ source_dir="$base_dir"/`basename $base_path .$base_ext`
+ else
+ echo "Error: Input compressed file extension not recognized."
+ exit 1
+ fi
+ else
+ print_help
+ exit 1
+ fi
+fi
+if [ "x$build_dir" == "x" ]; then
+ if [ "x$source_dir" != "x" ]; then
+ base_dir=$source_dir
+ if [ "${source_dir:$((${#str}-1)):1}" == "/" ]; then
+ base_dir=`echo $source_dir | rev | cut -c 2- | rev`
+ fi
+ build_dir="$base_dir-build"
+ else
+ print_help
+ exit 1
+ fi
+fi
+
+## Locate cmake executable
+if [ "x$cmake_exec" == "x" ]; then
+ cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+ cmake_ver=""
+ for loc in ${cmake_locations[@]}; do
+ cmake_file="$loc/cmake"
+ if [ -x $cmake_file ]; then
+ str=`$cmake_file --version | grep version`
+ version=${str:14}
+ if [ "$cmake_ver" \< "$version" ]; then
+ cmake_ver=$version
+ cmake_exec=$cmake_file
+ fi
+ fi
+ done
+fi
+if [ ! -x $cmake_exec ]; then
+ echo "ERROR: no valid cmake found."
+ exit 1
+fi
+cmake_exec=`abspath $cmake_exec`
+
+# Locate qmake executable
+if [ "x$qmake_exec" == "x" ]; then
+ qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+ for loc in ${qmake_locations[@]}; do
+ qmake_file="$loc/qmake"
+ if [ -x $qmake_file ]; then
+ version=`$qmake_file --version | grep Using\ Qt\ version | cut -d ' ' -f 4`
+ if [ "${version:0:3}" == "4.8" ]; then
+ qmake_exec=$qmake_file
+ fi
+ fi
+ done
+fi
+qmake_exec=`abspath $qmake_exec`
+if [ -x $qmake_exec ]; then
+ use_qt="1"
+else
+ use_qt="0"
+fi
+
+## Other configuration variables
+platform=`uname`
+number_of_cores=`grep -c ^processor /proc/cpuinfo`
+number_of_threads=`expr $number_of_cores / 2`
+if [ "x$source_file" != "x" ]; then
+ source_file=`abspath $source_file`
+fi
+source_dir=`abspath $source_dir`
+build_dir=`abspath $build_dir`
+
+echo "====================================================================="
+echo "==> Source file : $source_file"
+echo "==> Source dir : $source_dir"
+echo "==> Build dir : $build_dir"
+echo "==> Build type : $build_type"
+echo "==> Prefix : $prefix"
+echo "==> cmake : $cmake_exec"
+echo "==> qmake : $qmake_exec"
+echo "==> Use Qt : $use_qt"
+echo "==> Platform : $platform"
+echo "==> Number of cores : $number_of_cores"
+echo "==> Number of threads : $number_of_threads"
+echo "====================================================================="
+read -n1 -r -p "Continue? [Y/N]... " key
+echo
+if [ "$key" != 'Y' -a "$key" != 'y' ] ; then
+ exit 1
+fi
+
+## Create paths
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Cleaning directories... "
+ rm -rf $source_dir
+ rm -rf $build_dir
+ echo "done."
+ echo -n "==> Creating directories... "
+ mkdir -p $source_dir
+ mkdir -p $build_dir
+ echo "done."
+fi
+
+## Extract source code
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Extracting sources... "
+ base_path=`abspath $source_file`
+ base_ext=`get_file_extension $base_path`
+ if [ "$base_ext" == "zip" ]; then
+ echo unzip $base_path
+ elif [ "$base_ext" == "tar" ]; then
+ tar xf $base_path -C $source_dir --strip-components=1
+ elif [ "$base_ext" == "tar.gz" ]; then
+ tar xzf $base_path -C $source_dir --strip-components=1
+ elif [ "$base_ext" == "tar.bz2" ]; then
+ tar xjf $base_path -C $source_dir --strip-components=1
+ fi
+ echo "done."
+fi
+
+echo "==> Configuring sources... "
+cd $build_dir
+if [ "$use_qt" == "1" ]; then
+ $cmake_exec \
+ -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
+ -DBUILD_DOCUMENTATION:BOOL=OFF \
+ -DBUILD_EXAMPLES:BOOL=OFF \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ -DBUILD_TESTING:BOOL=OFF \
+ -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exec \
+ -DCMAKE_BUILD_TYPE:STRING=$build_type \
+ -DModule_vtkGUISupportQt:BOOL=ON \
+ -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
+ -DModule_vtkGUISupportQtSQL:BOOL=OFF \
+ -DModule_vtkGUISupportQtWebkit:BOOL=OFF \
+ -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
+ ${source_dir}
+else
+ $cmake_exec \
+ -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
+ -DBUILD_DOCUMENTATION:BOOL=OFF \
+ -DBUILD_EXAMPLES:BOOL=OFF \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ -DBUILD_TESTING:BOOL=OFF \
+ -DCMAKE_BUILD_TYPE:STRING=$build_type \
+ -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
+ ${source_dir}
+fi
+echo "==> Configuring sources... done."
+
+echo "==> Compiling sources..."
+cd $build_dir
+make -j$number_of_threads
+echo "==> Compiling sources... done."
+
+echo "==> Installing package..."
+cd $build_dir
+make -j install
+echo "==> Installing package... done."
+
+## eof - $RCSfile$
{
/**
*/
- template< class _TGradient >
+ template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
class FluxMedialness
- : public GradientImageFunctionBase< _TGradient >
+ : public GradientImageFunctionBase< _TGradient, _TMask >
{
public:
- typedef FluxMedialness Self;
- typedef GradientImageFunctionBase< _TGradient > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef FluxMedialness Self;
+ typedef GradientImageFunctionBase< _TGradient, _TMask > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
itkStaticConstMacro( Dimension, unsigned int, Superclass::Dimension );
#include <itkLineConstIterator.h>
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::FluxMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::FluxMedialness< _TGradient, _TMask >::
FluxMedialness( )
: Superclass( ),
m_MinRadius( double( 0 ) ),
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::FluxMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::FluxMedialness< _TGradient, _TMask >::
~FluxMedialness( )
{
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-typename cpExtensions::Algorithms::FluxMedialness< _TGradient >::
-TOutput cpExtensions::Algorithms::FluxMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+typename cpExtensions::Algorithms::FluxMedialness< _TGradient, _TMask >::
+TOutput cpExtensions::Algorithms::FluxMedialness< _TGradient, _TMask >::
_Evaluate( const TIndex& i ) const
{
itk::Object::GlobalWarningDisplayOff( );
/**
* Base class to compute values based on image gradients (vector).
*/
- template< class _TGradient >
+ template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
class GradientImageFunctionBase
: public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType >
{
public:
// Types from input arguments
typedef _TGradient TGradient;
+ typedef _TMask TMask;
typedef typename _TGradient::PixelType TVector;
typedef typename TVector::ValueType TScalar;
- itkStaticConstMacro( Dimension, unsigned int, _TGradient::ImageDimension );
+ itkStaticConstMacro(
+ Dimension, unsigned int, _TGradient::ImageDimension
+ );
// Standard itk types
typedef GradientImageFunctionBase Self;
public:
itkTypeMacro( GradientImageFunctionBase, itkImageFunction );
+ itkGetConstObjectMacro( Mask, TMask );
+ itkSetConstObjectMacro( Mask, TMask );
+
public:
virtual void Prepare( ) const;
virtual TOutput Evaluate( const TPoint& p ) const cpExtensions_OVERRIDE;
// Purposely not implemented.
GradientImageFunctionBase( const Self& );
void operator=( const Self& );
+
+ protected:
+ typename _TMask::ConstPointer m_Mask;
};
} // ecapseman
#define __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__HXX__
// -------------------------------------------------------------------------
-template< class _TGradient >
-void cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
+template< class _TGradient, class _TMask >
+void
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
Prepare( ) const
{
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-typename cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
-TOutput cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
+template< class _TGradient, class _TMask >
+typename
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
+TOutput
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
Evaluate( const TPoint& p ) const
{
TIndex i;
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-typename cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
-TOutput cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
+template< class _TGradient, class _TMask >
+typename
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
+TOutput
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
EvaluateAtIndex( const TIndex& i ) const
{
- return( this->_Evaluate( i ) );
+ bool eval = true;
+ if( this->m_Mask.IsNotNull( ) )
+ eval = ( ( unsigned long )( this->m_Mask->GetPixel( i ) ) > 0 );
+ if( eval )
+ return( this->_Evaluate( i ) );
+ else
+ return( TOutput( 0 ) );
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-typename cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
-TOutput cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
+template< class _TGradient, class _TMask >
+typename
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
+TOutput
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
EvaluateAtContinuousIndex( const TContIndex& i ) const
{
TPoint p;
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
GradientImageFunctionBase( )
: Superclass( )
{
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::GradientImageFunctionBase< _TGradient, _TMask >::
~GradientImageFunctionBase( )
{
}
{
/**
*/
- template< class _TGradient >
+ template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
class GulsunTekMedialness
- : public GradientImageFunctionBase< _TGradient >
+ : public GradientImageFunctionBase< _TGradient, _TMask >
{
public:
- typedef GulsunTekMedialness Self;
- typedef GradientImageFunctionBase< _TGradient > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef GulsunTekMedialness Self;
+ typedef GradientImageFunctionBase< _TGradient, _TMask > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
itkStaticConstMacro( Dimension, unsigned int, Superclass::Dimension );
#include <itkLineConstIterator.h>
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::GulsunTekMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::GulsunTekMedialness< _TGradient, _TMask >::
GulsunTekMedialness( )
: Superclass( ),
m_MinRadius( double( 0 ) ),
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::GulsunTekMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::GulsunTekMedialness< _TGradient, _TMask >::
~GulsunTekMedialness( )
{
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-typename cpExtensions::Algorithms::GulsunTekMedialness< _TGradient >::
-TOutput cpExtensions::Algorithms::GulsunTekMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+typename cpExtensions::Algorithms::GulsunTekMedialness< _TGradient, _TMask >::
+TOutput cpExtensions::Algorithms::GulsunTekMedialness< _TGradient, _TMask >::
_Evaluate( const TIndex& i ) const
{
itk::Object::GlobalWarningDisplayOff( );
{
/**
*/
- template< class _TGradient >
+ template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
class MFluxMedialness
- : public GradientImageFunctionBase< _TGradient >
+ : public GradientImageFunctionBase< _TGradient, _TMask >
{
public:
- typedef MFluxMedialness Self;
- typedef GradientImageFunctionBase< _TGradient > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef MFluxMedialness Self;
+ typedef GradientImageFunctionBase< _TGradient, _TMask > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
itkStaticConstMacro( Dimension, unsigned int, Superclass::Dimension );
#include <itkLineConstIterator.h>
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::MFluxMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::MFluxMedialness< _TGradient, _TMask >::
MFluxMedialness( )
: Superclass( ),
m_MinRadius( double( 0 ) ),
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-cpExtensions::Algorithms::MFluxMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+cpExtensions::Algorithms::MFluxMedialness< _TGradient, _TMask >::
~MFluxMedialness( )
{
}
// -------------------------------------------------------------------------
-template< class _TGradient >
-typename cpExtensions::Algorithms::MFluxMedialness< _TGradient >::
-TOutput cpExtensions::Algorithms::MFluxMedialness< _TGradient >::
+template< class _TGradient, class _TMask >
+typename cpExtensions::Algorithms::MFluxMedialness< _TGradient, _TMask >::
+TOutput cpExtensions::Algorithms::MFluxMedialness< _TGradient, _TMask >::
_Evaluate( const TIndex& i ) const
{
itk::Object::GlobalWarningDisplayOff( );
void cpExtensions::QT::ImageWidget::
SetScalarRange( double r[ 2 ] )
{
+ auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
+ if( actor != NULL )
+ {
+ actor->ConfigureWindowLevel( r[ 0 ], r[ 1 ] );
+ this->Render( );
+
+ } // fi
}
// -------------------------------------------------------------------------
void cpExtensions::QT::ImageWidget::
SetWindowLevel( double wl[ 2 ] )
{
+ auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
+ if( actor != NULL )
+ {
+ actor->SetWindowLevel( wl[ 0 ], wl[ 1 ] );
+ this->Render( );
+
+ } // fi
}
// -------------------------------------------------------------------------
void cpExtensions::QT::ImageWidget::
SetImageInterpolation( unsigned char i )
{
+ auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
+ if( actor != NULL )
+ {
+ int int_type = 0;
+ switch( i )
+ {
+ case 'L': int_type = VTK_LINEAR_INTERPOLATION; break;
+ case 'C': int_type = VTK_CUBIC_INTERPOLATION; break;
+ default : int_type = VTK_NEAREST_INTERPOLATION; break;
+ } // hctiws
+ actor->GetProperty( )->SetInterpolationType( int_type );
+ this->Render( );
+
+ } // fi
}
#endif // cpExtensions_QT4
void cpExtensions::QT::SimpleMPRWidget::
SetScalarRange( double r[ 2 ] )
{
+ this->m_XImage->SetScalarRange( r );
+ this->m_YImage->SetScalarRange( r );
+ this->m_ZImage->SetScalarRange( r );
+ this->m_3DView->SetScalarRange( r );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
SetWindowLevel( double wl[ 2 ] )
{
+ this->m_XImage->SetWindowLevel( wl );
+ this->m_YImage->SetWindowLevel( wl );
+ this->m_ZImage->SetWindowLevel( wl );
+ this->m_3DView->SetWindowLevel( wl );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
SetImageInterpolation( unsigned char i )
{
+ this->m_XImage->SetImageInterpolation( i );
+ this->m_YImage->SetImageInterpolation( i );
+ this->m_ZImage->SetImageInterpolation( i );
+ this->m_3DView->SetImageInterpolation( i );
}
// -------------------------------------------------------------------------
this->m_Data->GetWindowLevel( win_lev );
// Intensity range
+ this->m_UI->MinimumBox->setMinimum( -1000000 );
+ this->m_UI->MinimumBox->setMaximum( 1000000 );
+ this->m_UI->MaximumBox->setMinimum( -1000000 );
+ this->m_UI->MaximumBox->setMaximum( 1000000 );
this->m_UI->MinimumBox->setValue( range[ 0 ] );
this->m_UI->MaximumBox->setValue( range[ 1 ] );
default : this->m_UI->InterpolatorBox->setCurrentIndex( 0 ); break;
} // hctiws
- /* TODO
- this->connect(
- this->m_UI->Top, SIGNAL( splitterMoved( int, int ) ),
- this, SLOT( _SyncBottom( int, int ) )
- );
- */
-
+ // Slots <-> signals
this->connect(
this->m_UI->MaximumBox, SIGNAL( valueChanged( int ) ),
this, SLOT( _maximumValue( int ) )
void cpExtensions::QT::WindowLevelImageConfiguration::
_maximumValue( int v )
{
+ double range[ 2 ];
+ range[ 0 ] = double( this->m_UI->MinimumBox->value( ) );
+ range[ 1 ] = double( v );
+ this->m_Data->SetScalarRange( range );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::WindowLevelImageConfiguration::
_minimumValue( int v )
{
+ double range[ 2 ];
+ range[ 0 ] = double( v );
+ range[ 1 ] = double( this->m_UI->MaximumBox->value( ) );
+ this->m_Data->SetScalarRange( range );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::WindowLevelImageConfiguration::
_levelValue( int v )
{
+ double r[ 2 ];
+ double l, s;
+
+ this->m_Data->GetScalarRange( r );
+ if( this->sender( ) == this->m_UI->LevelSlider )
+ {
+ s = double( v ) / double( this->m_UI->LevelSlider->maximum( ) );
+ l = ( ( r[ 1 ] - r[ 0 ] ) * s ) + r[ 0 ];
+ }
+ else
+ {
+ l = double( v );
+ s = ( l - r[ 0 ] ) / ( r[ 1 ] - r[ 0 ] );
+
+ } // fi
+ s *= this->m_UI->LevelSlider->maximum( );
+
+ bool b = this->m_UI->LevelSlider->blockSignals( true );
+ this->m_UI->LevelSlider->setValue( s );
+ this->m_UI->LevelSlider->blockSignals( b );
+ b = this->m_UI->LevelBox->blockSignals( true );
+ this->m_UI->LevelBox->setValue( l );
+ this->m_UI->LevelBox->blockSignals( b );
+
+ double wl[ 2 ];
+ this->m_Data->GetWindowLevel( wl );
+ wl[ 1 ] = l;
+ this->m_Data->SetWindowLevel( wl );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::WindowLevelImageConfiguration::
_windowValue( int v )
{
+ double r[ 2 ];
+ double w, s;
+
+ this->m_Data->GetScalarRange( r );
+ if( this->sender( ) == this->m_UI->WindowSlider )
+ {
+ s = double( v ) / double( this->m_UI->WindowSlider->maximum( ) );
+ w = ( ( r[ 1 ] - r[ 0 ] ) * s ) + r[ 0 ];
+ }
+ else
+ {
+ w = double( v );
+ s = ( w - r[ 0 ] ) / ( r[ 1 ] - r[ 0 ] );
+
+ } // fi
+ s *= this->m_UI->WindowSlider->maximum( );
+
+ bool b = this->m_UI->WindowSlider->blockSignals( true );
+ this->m_UI->WindowSlider->setValue( s );
+ this->m_UI->WindowSlider->blockSignals( b );
+ b = this->m_UI->WindowBox->blockSignals( true );
+ this->m_UI->WindowBox->setValue( w );
+ this->m_UI->WindowBox->blockSignals( b );
+
+ double wl[ 2 ];
+ this->m_Data->GetWindowLevel( wl );
+ wl[ 0 ] = w;
+ this->m_Data->SetWindowLevel( wl );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::WindowLevelImageConfiguration::
_interpolatorValue( int v )
{
+ switch( v )
+ {
+ case 1 : this->m_Data->SetImageInterpolation( 'L' ); break;
+ case 2 : this->m_Data->SetImageInterpolation( 'C' ); break;
+ default : this->m_Data->SetImageInterpolation( 'N' ); break;
+ } // hctiws
}
#endif // cpExtensions_QT4
typedef QWidget Superclass;
public:
- explicit WindowLevelImageConfiguration( QWidget* parent = NULL, Qt::WindowFlags f = 0 );
+ explicit WindowLevelImageConfiguration(
+ QWidget* parent = NULL, Qt::WindowFlags f = 0
+ );
virtual ~WindowLevelImageConfiguration( );
void setData( SimpleMPRWidget* data );
<rect>
<x>0</x>
<y>0</y>
- <width>342</width>
- <height>148</height>
+ <width>313</width>
+ <height>322</height>
</rect>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>313</width>
+ <height>322</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QLabel" name="label_3">
- <property name="geometry">
- <rect>
- <x>2</x>
- <y>7</y>
- <width>50</width>
- <height>14</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>14</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>14</height>
- </size>
- </property>
- <property name="text">
- <string>Window:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- <widget class="QSpinBox" name="WindowBox">
- <property name="geometry">
- <rect>
- <x>58</x>
- <y>2</y>
- <width>79</width>
- <height>24</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <property name="minimum">
- <number>-100000</number>
- </property>
- <property name="maximum">
- <number>100000</number>
- </property>
- </widget>
- <widget class="QSlider" name="WindowSlider">
- <property name="geometry">
- <rect>
- <x>143</x>
- <y>6</y>
- <width>84</width>
- <height>16</height>
- </rect>
- </property>
- <property name="maximum">
- <number>1000</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- <widget class="QLabel" name="label_4">
- <property name="geometry">
- <rect>
- <x>2</x>
- <y>39</y>
- <width>35</width>
- <height>14</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>14</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>14</height>
- </size>
- </property>
- <property name="text">
- <string>Level:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- <widget class="QSpinBox" name="LevelBox">
- <property name="geometry">
- <rect>
- <x>43</x>
- <y>34</y>
- <width>79</width>
- <height>24</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <property name="minimum">
- <number>-100000</number>
- </property>
- <property name="maximum">
- <number>100000</number>
- </property>
- </widget>
- <widget class="QSlider" name="LevelSlider">
- <property name="geometry">
- <rect>
- <x>128</x>
- <y>38</y>
- <width>84</width>
- <height>16</height>
- </rect>
- </property>
- <property name="maximum">
- <number>1000</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>3</x>
- <y>82</y>
- <width>61</width>
- <height>14</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>61</width>
- <height>14</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>61</width>
- <height>14</height>
- </size>
- </property>
- <property name="text">
- <string>Maximum:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- <widget class="QSpinBox" name="MaximumBox">
- <property name="geometry">
- <rect>
- <x>70</x>
- <y>77</y>
- <width>79</width>
- <height>24</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <property name="minimum">
- <number>-100000</number>
- </property>
- <property name="maximum">
- <number>100000</number>
- </property>
- </widget>
- <widget class="QLabel" name="label_5">
- <property name="geometry">
- <rect>
- <x>157</x>
- <y>82</y>
- <width>84</width>
- <height>14</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>84</width>
- <height>14</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>84</width>
- <height>14</height>
- </size>
- </property>
- <property name="text">
- <string>Interpolation:</string>
- </property>
- </widget>
- <widget class="QComboBox" name="InterpolatorBox">
- <property name="geometry">
- <rect>
- <x>247</x>
- <y>77</y>
- <width>81</width>
- <height>24</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <item>
- <property name="text">
- <string>Nearest</string>
- </property>
- </item>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <property name="text">
- <string>Linear</string>
- </property>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Window:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="WindowBox"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QSlider" name="WindowSlider">
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ <property name="pageStep">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Level:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="LevelBox"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QSlider" name="LevelSlider">
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ <property name="pageStep">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Minimum:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="MinimumBox"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Maximum:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="MaximumBox"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
</item>
<item>
- <property name="text">
- <string>Cubic</string>
- </property>
+ <widget class="QFrame" name="frame_2">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Interpolation:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="InterpolatorBox">
+ <item>
+ <property name="text">
+ <string>Nearest</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Linear</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Cubic</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Opacity:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="OpacitySlider">
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
</item>
- </widget>
- <widget class="QLabel" name="label_2">
- <property name="geometry">
- <rect>
- <x>3</x>
- <y>116</y>
- <width>58</width>
- <height>14</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>58</width>
- <height>14</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>58</width>
- <height>14</height>
- </size>
- </property>
- <property name="text">
- <string>Minimum:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- <widget class="QSpinBox" name="MinimumBox">
- <property name="geometry">
- <rect>
- <x>67</x>
- <y>111</y>
- <width>79</width>
- <height>24</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <property name="minimum">
- <number>-100000</number>
- </property>
- <property name="maximum">
- <number>100000</number>
- </property>
- </widget>
- <widget class="QLabel" name="label_6">
- <property name="geometry">
- <rect>
- <x>154</x>
- <y>112</y>
- <width>49</width>
- <height>14</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>49</width>
- <height>14</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>49</width>
- <height>14</height>
- </size>
- </property>
- <property name="text">
- <string>Opacity:</string>
- </property>
- </widget>
- <widget class="QSlider" name="OpacitySlider">
- <property name="geometry">
- <rect>
- <x>209</x>
- <y>111</y>
- <width>84</width>
- <height>16</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>16</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16</height>
- </size>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="pageStep">
- <number>5</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
+ </layout>
+ <zorder>label</zorder>
+ <zorder>label_2</zorder>
+ <zorder>label_3</zorder>
+ <zorder>label_4</zorder>
+ <zorder>label_5</zorder>
+ <zorder>label_6</zorder>
+ <zorder>InterpolatorBox</zorder>
+ <zorder>WindowSlider</zorder>
+ <zorder>LevelSlider</zorder>
+ <zorder>OpacitySlider</zorder>
+ <zorder>MinimumBox</zorder>
+ <zorder>MaximumBox</zorder>
+ <zorder>WindowSlider</zorder>
+ <zorder>frame</zorder>
+ <zorder>frame_2</zorder>
</widget>
<resources/>
<connections/>
: Superclass( )
{
this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false );
+ this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Mask", false, false );
this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" );
this->m_Parameters.ConfigureAsReal( "MinRadius" );
: Superclass( )
{
this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false );
+ this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Mask", false, false );
this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" );
this->m_Parameters.ConfigureAsReal( "MinRadius" );
template< class _TImage >
void cpPluginsImageGradientFilters::GulsunTekImageFilter::
_GD0( _TImage* image )
+{
+ typedef itk::Image< char, _TImage::ImageDimension > _TChar;
+ typedef itk::Image< short, _TImage::ImageDimension > _TShort;
+ typedef itk::Image< int, _TImage::ImageDimension > _TInt;
+ typedef itk::Image< long, _TImage::ImageDimension > _TLong;
+ typedef itk::Image< float, _TImage::ImageDimension > _TFloat;
+ typedef itk::Image< double, _TImage::ImageDimension > _TDouble;
+ typedef itk::Image< unsigned char, _TImage::ImageDimension > _TUChar;
+ typedef itk::Image< unsigned short, _TImage::ImageDimension > _TUShort;
+ typedef itk::Image< unsigned int, _TImage::ImageDimension > _TUInt;
+ typedef itk::Image< unsigned long, _TImage::ImageDimension > _TULong;
+
+ auto m = this->GetInput( "Mask" );
+ auto ci = m->GetITK< _TChar >( );
+ auto si = m->GetITK< _TShort >( );
+ auto ii = m->GetITK< _TInt >( );
+ auto li = m->GetITK< _TLong >( );
+ auto fi = m->GetITK< _TFloat >( );
+ auto di = m->GetITK< _TDouble >( );
+ auto uci = m->GetITK< _TUChar >( );
+ auto usi = m->GetITK< _TUShort >( );
+ auto uii = m->GetITK< _TUInt >( );
+ auto uli = m->GetITK< _TULong >( );
+ if ( ci != NULL ) this->_GD1( image, ci );
+ else if( si != NULL ) this->_GD1( image, si );
+ else if( ii != NULL ) this->_GD1( image, ii );
+ else if( li != NULL ) this->_GD1( image, li );
+ else if( fi != NULL ) this->_GD1( image, fi );
+ else if( di != NULL ) this->_GD1( image, di );
+ else if( uci != NULL ) this->_GD1( image, uci );
+ else if( usi != NULL ) this->_GD1( image, usi );
+ else if( uii != NULL ) this->_GD1( image, uii );
+ else if( uli != NULL ) this->_GD1( image, uli );
+ else this->_GD1( image, ci );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TMask >
+void cpPluginsImageGradientFilters::GulsunTekImageFilter::
+_GD1( _TImage* image, _TMask* mask )
{
typedef typename _TImage::PixelType _TGradient;
- typedef cpExtensions::Algorithms::GulsunTekMedialness< _TImage > _TFunction;
+ typedef cpExtensions::Algorithms::GulsunTekMedialness< _TImage, _TMask > _TFunction;
typedef typename _TFunction::TOutput _TScalar;
typedef itk::Image< _TScalar, _TImage::ImageDimension > _TOutputImage;
typedef cpExtensions::Algorithms::ImageFunctionFilter< _TImage, _TOutputImage, _TFunction > _TFilter;
function->SetProfileSampling( this->m_Parameters.GetUint( "ProfileSampling" ) );
function->SetRadialSampling( this->m_Parameters.GetUint( "RadialSampling" ) );
filter->SetInput( image );
+ if( mask != NULL )
+ function->SetMask( mask );
filter->Update( );
this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
protected:
template< class _TImage >
inline void _GD0( _TImage* image );
+
+ template< class _TImage, class _TMask >
+ inline void _GD1( _TImage* image, _TMask* mask );
};
} // ecapseman
#include <cpPlugins/DataObjects/Image.h>
#include <cpExtensions/Algorithms/ImageFunctionFilter.h>
-#include <cpExtensions/Algorithms/FluxMedialness.h>
+#include <cpExtensions/Algorithms/MFluxMedialness.h>
#include <cpExtensions/Algorithms/ImageFunctionFilter.hxx>
-#include <cpExtensions/Algorithms/FluxMedialness.hxx>
+#include <cpExtensions/Algorithms/MFluxMedialness.hxx>
#include <cpExtensions/Algorithms/GradientImageFunctionBase.hxx>
#include <itkImageFunction.hxx>
: Superclass( )
{
this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false );
+ this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Mask", false, false );
this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" );
this->m_Parameters.ConfigureAsReal( "MinRadius" );
_GD0( _TImage* image )
{
typedef typename _TImage::PixelType _TGradient;
- typedef cpExtensions::Algorithms::FluxMedialness< _TImage > _TFunction;
+ typedef cpExtensions::Algorithms::MFluxMedialness< _TImage > _TFunction;
typedef typename _TFunction::TOutput _TScalar;
typedef itk::Image< _TScalar, _TImage::ImageDimension > _TOutputImage;
typedef cpExtensions::Algorithms::ImageFunctionFilter< _TImage, _TOutputImage, _TFunction > _TFilter;