]> Creatis software - cpPlugins.git/commitdiff
Medialness filters updated.
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Mon, 12 Sep 2016 20:01:31 +0000 (15:01 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Mon, 12 Sep 2016 20:01:31 +0000 (15:01 -0500)
28 files changed:
CMakeLists.txt
appli/CMakeLists.txt
appli/PipelineEditor/CMakeLists.txt [new file with mode: 0644]
appli/PipelineEditor/PipelineEditorMainWindow.cxx [new file with mode: 0644]
appli/PipelineEditor/PipelineEditorMainWindow.h [new file with mode: 0644]
appli/PipelineEditor/PipelineEditorMainWindow.ui [new file with mode: 0644]
appli/PipelineEditor/main.cxx [new file with mode: 0644]
cmake/cpPluginsConfig.cmake.in
dependencies/cpPlugins_Install_CMAKE.sh [new file with mode: 0755]
dependencies/cpPlugins_Install_ITK.sh [new file with mode: 0755]
dependencies/cpPlugins_Install_VTK.sh [new file with mode: 0755]
lib/cpExtensions/Algorithms/FluxMedialness.h
lib/cpExtensions/Algorithms/FluxMedialness.hxx
lib/cpExtensions/Algorithms/GradientImageFunctionBase.h
lib/cpExtensions/Algorithms/GradientImageFunctionBase.hxx
lib/cpExtensions/Algorithms/GulsunTekMedialness.h
lib/cpExtensions/Algorithms/GulsunTekMedialness.hxx
lib/cpExtensions/Algorithms/MFluxMedialness.h
lib/cpExtensions/Algorithms/MFluxMedialness.hxx
lib/cpExtensions/QT/ImageWidget.cxx
lib/cpExtensions/QT/SimpleMPRWidget.cxx
lib/cpExtensions/QT/WindowLevelImageConfiguration.cxx
lib/cpExtensions/QT/WindowLevelImageConfiguration.h
lib/cpExtensions/QT/WindowLevelImageConfiguration.ui
plugins/ImageGradientFilters/FluxImageFilter.cxx
plugins/ImageGradientFilters/GulsunTekImageFilter.cxx
plugins/ImageGradientFilters/GulsunTekImageFilter.h
plugins/ImageGradientFilters/MFluxImageFilter.cxx

index 6c7e166e8a4cc417b242ff2e47cb207ecc2f6c6a..85fe564e12faa23b5818b28e1ece42a5ee791f34 100644 (file)
@@ -1,4 +1,4 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
 
 ## ========================
 ## == Project definition ==
index da6aca406d4386d21c0d59f600661661f9a1fc22..cc05c08e9968b6a8639a5ad5d8739cd89b781df5 100644 (file)
@@ -1,6 +1,7 @@
 SUBDIRS(
   bash
   examples
+  PipelineEditor
   )
 
 ## eof - $RCSfile$
diff --git a/appli/PipelineEditor/CMakeLists.txt b/appli/PipelineEditor/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d36b67c
--- /dev/null
@@ -0,0 +1,8 @@
+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$
diff --git a/appli/PipelineEditor/PipelineEditorMainWindow.cxx b/appli/PipelineEditor/PipelineEditorMainWindow.cxx
new file mode 100644 (file)
index 0000000..ddabd0e
--- /dev/null
@@ -0,0 +1,36 @@
+#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$
diff --git a/appli/PipelineEditor/PipelineEditorMainWindow.h b/appli/PipelineEditor/PipelineEditorMainWindow.h
new file mode 100644 (file)
index 0000000..b4018c1
--- /dev/null
@@ -0,0 +1,36 @@
+#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$
diff --git a/appli/PipelineEditor/PipelineEditorMainWindow.ui b/appli/PipelineEditor/PipelineEditorMainWindow.ui
new file mode 100644 (file)
index 0000000..8e257be
--- /dev/null
@@ -0,0 +1,189 @@
+<?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>&amp;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>&amp;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>&amp;Open</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O</string>
+   </property>
+  </action>
+  <action name="ActionSave">
+   <property name="text">
+    <string>&amp;Save</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+S</string>
+   </property>
+  </action>
+  <action name="ActionExit">
+   <property name="text">
+    <string>E&amp;xit</string>
+   </property>
+  </action>
+  <action name="ActionClose">
+   <property name="text">
+    <string>&amp;Close</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+C</string>
+   </property>
+  </action>
+  <action name="ActionLoadPluginFile">
+   <property name="text">
+    <string>Load &amp;file</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+P</string>
+   </property>
+  </action>
+  <action name="ActionLoadPluginDirectory">
+   <property name="text">
+    <string>Load &amp;directory</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+D</string>
+   </property>
+  </action>
+  <action name="ActionShowPlugins">
+   <property name="text">
+    <string>&amp;Show</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+S</string>
+   </property>
+  </action>
+  <action name="ActionAddEnvironmentPath">
+   <property name="text">
+    <string>&amp;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>
diff --git a/appli/PipelineEditor/main.cxx b/appli/PipelineEditor/main.cxx
new file mode 100644 (file)
index 0000000..a675420
--- /dev/null
@@ -0,0 +1,7 @@
+#include <cpBaseQtApplication/MainHelper.h>
+#include <appli/PipelineEditor/PipelineEditorMainWindow.h>
+
+cpBaseQtApplication_Main( PipelineEditorMainWindow );
+cpBaseQtApplication_MainComplement;
+
+// eof - $RCSfile$
index d1ecd6a7bf5e86edb33726fc72909466d07f181e..5465875a251d2d9288c7d6fdae37d2ae138bba2f 100644 (file)
@@ -2,38 +2,10 @@
 ## == 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 ==
 ## ====================
diff --git a/dependencies/cpPlugins_Install_CMAKE.sh b/dependencies/cpPlugins_Install_CMAKE.sh
new file mode 100755 (executable)
index 0000000..191927c
--- /dev/null
@@ -0,0 +1,198 @@
+#!/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$
diff --git a/dependencies/cpPlugins_Install_ITK.sh b/dependencies/cpPlugins_Install_ITK.sh
new file mode 100755 (executable)
index 0000000..d4b90c5
--- /dev/null
@@ -0,0 +1,216 @@
+#!/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$
diff --git a/dependencies/cpPlugins_Install_VTK.sh b/dependencies/cpPlugins_Install_VTK.sh
new file mode 100755 (executable)
index 0000000..9c5776a
--- /dev/null
@@ -0,0 +1,256 @@
+#!/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$
index dd5a3f245ce18c51fc3afc72f1064e0b91bbc14f..c25f5f47031209541fc4b37e66ffed60c5dfd72b 100644 (file)
@@ -9,15 +9,15 @@ namespace cpExtensions
   {
     /**
      */
-    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 );
 
index f4d8b9cf26a38c55b7c685fec242a293308d68b6..4412292eadbe0f1a147d48b571aec8adce00aacc 100644 (file)
@@ -6,8 +6,8 @@
 #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 ) ),
@@ -18,16 +18,16 @@ FluxMedialness( )
 }
 
 // -------------------------------------------------------------------------
-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( );
index bc6bd3643845e5e3a4d1bf4085922d6b476cd69b..f6d3e5cef804e1faa4da31c444fb15fc5b0b213b 100644 (file)
@@ -10,16 +10,19 @@ namespace cpExtensions
     /**
      * 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;
@@ -37,6 +40,9 @@ namespace cpExtensions
     public:
       itkTypeMacro( GradientImageFunctionBase, itkImageFunction );
 
+      itkGetConstObjectMacro( Mask, TMask );
+      itkSetConstObjectMacro( Mask, TMask );
+
     public:
       virtual void Prepare( ) const;
       virtual TOutput Evaluate( const TPoint& p ) const cpExtensions_OVERRIDE;
@@ -53,6 +59,9 @@ namespace cpExtensions
       // Purposely not implemented.
       GradientImageFunctionBase( const Self& );
       void operator=( const Self& );
+
+    protected:
+      typename _TMask::ConstPointer m_Mask;
     };
 
   } // ecapseman
index f4cb928aa59a786fbb9c27aeff0477be757290a0..95681bd390525855af50fe8e4784e664eba28add 100644 (file)
@@ -2,16 +2,19 @@
 #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;
@@ -20,18 +23,28 @@ Evaluate( const TPoint& p ) 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 >::
 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;
@@ -40,16 +53,16 @@ EvaluateAtContinuousIndex( const TContIndex& i ) const
 }
 
 // -------------------------------------------------------------------------
-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( )
 {
 }
index 979c41f6df6c207c83b434685ff7c1c88de0f147..15add9eacd806149d0b399f32cc60a1d8c5e2b7a 100644 (file)
@@ -9,15 +9,15 @@ namespace cpExtensions
   {
     /**
      */
-    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 );
 
index 941a37cd64da5b3d7ebffafef901907d0f7c81a5..fc599292cc2aa499c44aeec393d7fa27ac32d96c 100644 (file)
@@ -6,8 +6,8 @@
 #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 ) ),
@@ -18,16 +18,16 @@ GulsunTekMedialness( )
 }
 
 // -------------------------------------------------------------------------
-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( );
index 6726276ea375c0fcf109028f00623a18e126ff79..97bc44f21cd164e6a7a04de014be1f571bb9caf8 100644 (file)
@@ -9,15 +9,15 @@ namespace cpExtensions
   {
     /**
      */
-    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 );
 
index 20e7f15271530d94a9cc71b1667417d27fed512a..bc5db37a405f0459391fa736765258765b49e8e6 100644 (file)
@@ -6,8 +6,8 @@
 #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 ) ),
@@ -18,16 +18,16 @@ MFluxMedialness( )
 }
 
 // -------------------------------------------------------------------------
-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( );
index 7804fe76b213e5342915e416513cb47de64d5cf5..09788440c1bc6fd38931c32f166401932c0ccea1 100644 (file)
@@ -247,12 +247,26 @@ GetImageInterpolation( ) const
 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
 }
 
 // -------------------------------------------------------------------------
@@ -272,6 +286,20 @@ SetImageOpacity( double o )
 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
index 53fcb7f4abd5351ba4f941bbe273d173ff264db4..80390b66bc8b5278c30d3eac6d0f556353b8a442 100644 (file)
@@ -373,12 +373,20 @@ GetImageInterpolation( ) const
 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 );
 }
 
 // -------------------------------------------------------------------------
@@ -395,6 +403,10 @@ SetImageOpacity( double o )
 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 );
 }
 
 // -------------------------------------------------------------------------
index ca1c3c101b3bcb8996e15d7756a12a3f5b4ac6f8..c865f55d0a3d249646a7f7ac5211f9bc973d18b3 100644 (file)
@@ -35,6 +35,10 @@ setData( SimpleMPRWidget* data )
     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 ] );
 
@@ -77,13 +81,7 @@ setData( SimpleMPRWidget* data )
     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 ) )
@@ -124,24 +122,88 @@ setData( SimpleMPRWidget* data )
 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 );
 }
 
 // -------------------------------------------------------------------------
@@ -164,6 +226,12 @@ _opacityValue( int v )
 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
index e6910c0891cd2d812d8ca0aca67cf1c76776673e..665e741e8c87c9616e2b2dc617f30bfbb15c5eaa 100644 (file)
@@ -29,7 +29,9 @@ namespace cpExtensions
       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 );
index a066f2ee3d15de8b0b69ea0f0a736a9316cb1124..65d066ef1e0969dd7476452852e57d2fe10c53e0 100644 (file)
    <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/>
index 9e91a15a72b4c74fd5ec819c3dd83e454d29e0cf..806703d4caf6b3fc90e9686f8e21067624583448 100644 (file)
@@ -15,6 +15,7 @@ FluxImageFilter( )
   : 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" );
index 76a9bffca3f754d462d13b61c4fa691915a6e0a4..b707d0067a791867518159079ca528609a3e83e1 100644 (file)
@@ -15,6 +15,7 @@ GulsunTekImageFilter( )
   : 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" );
@@ -47,9 +48,49 @@ _GenerateData( )
 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;
@@ -67,6 +108,8 @@ _GD0( _TImage* image )
   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( ) );
 }
index abd995bb008a3d967855ac06f0e42d93483db38c..aafa51f16886dee3b6334f681f35a529e2232446 100644 (file)
@@ -20,6 +20,9 @@ namespace cpPluginsImageGradientFilters
   protected:
     template< class _TImage >
       inline void _GD0( _TImage* image );
+
+    template< class _TImage, class _TMask >
+      inline void _GD1( _TImage* image, _TMask* mask );
   };
 
 } // ecapseman
index b02701a4c4d9726ef43ea4cea2e24d7768e773c8..d1661187e0fdcff3c2530bb4179028418591b37e 100644 (file)
@@ -2,10 +2,10 @@
 #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>
 
@@ -15,6 +15,7 @@ MFluxImageFilter( )
   : 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" );
@@ -49,7 +50,7 @@ void cpPluginsImageGradientFilters::MFluxImageFilter::
 _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;