]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Tue, 4 Dec 2018 07:46:52 +0000 (08:46 +0100)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Tue, 4 Dec 2018 07:46:52 +0000 (08:46 +0100)
88 files changed:
.travis.yml
cluster_tools/gate_power_merge.sh
cluster_tools/mergeDoseByRegions.sh
common/clitkDicomRTDoseIO.cxx
common/clitkDicomRTDoseIO.h
common/clitkDicomRT_Contour.cxx
common/clitkDicomRT_Contour.h
common/clitkDicomRT_ROI.cxx
common/clitkDicomRT_ROI.h
common/clitkDicomRT_StructureSet.cxx
common/clitkDicomRT_StructureSet.h
itk/RelativePositionPropImageFilter.h
itk/RelativePositionPropImageFilter.txx
itk/clitkBackProjectImageFilter.h
itk/clitkBackProjectImageFilter.txx
itk/clitkForwardWarpImageFilter.h
itk/clitkForwardWarpImageFilter.txx
itk/clitkInvertVFFilter.h
itk/clitkInvertVFFilter.txx
itk/clitkPasteImageFilter.hxx
itk/clitkResampleImageWithOptionsFilter.txx
registration/CMakeLists.txt
registration/clitkAffineRegistrationGenericFilter.cxx
registration/clitkBLUTDIRGenericFilter.cxx
registration/clitkCorrelationRatioImageToImageMetric.h
registration/clitkCorrelationRatioImageToImageMetric.txx
registration/clitkDemonsDeformableRegistrationGenericFilter.txx
registration/clitkOptNormalizedCorrelationImageToImageMetric.h
registration/clitkOptNormalizedCorrelationImageToImageMetric.txx
registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h
registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h
registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx
tools/CMakeLists.txt
tools/clitkAffineTransformGenericFilter.txx
tools/clitkBackProjectImageGenericFilter.txx
tools/clitkCropImage.ggo
tools/clitkCropImageGenericFilter.cxx
tools/clitkDicom2Image.cxx
tools/clitkDicomInfo.cxx
tools/clitkExtrude.cxx [new file with mode: 0644]
tools/clitkExtrude.ggo [new file with mode: 0644]
tools/clitkExtrudeGenericFilter.h [new file with mode: 0644]
tools/clitkExtrudeGenericFilter.txx [new file with mode: 0644]
tools/clitkGateSimulation2DicomGenericFilter.txx
tools/clitkImage2DicomDoseGenericFilter.txx
tools/clitkInvertVFGenericFilter.txx
tools/clitkPartitionEnergyWindowDicomGenericFilter.txx
tools/clitkRTStructStatistics.cxx [new file with mode: 0644]
tools/clitkRTStructStatistics.ggo [new file with mode: 0644]
tools/clitkRTStructStatisticsGenericFilter.cxx [new file with mode: 0644]
tools/clitkRTStructStatisticsGenericFilter.h [new file with mode: 0644]
tools/clitkRTStructStatisticsGenericFilter.txx [new file with mode: 0644]
tools/clitkSUVPeak.cxx [new file with mode: 0644]
tools/clitkSUVPeak.ggo [new file with mode: 0644]
tools/clitkSUVPeakGenericFilter.cxx [new file with mode: 0644]
tools/clitkSUVPeakGenericFilter.h [new file with mode: 0644]
tools/clitkSUVPeakGenericFilter.txx [new file with mode: 0644]
tools/clitkScintivolStats.cxx [new file with mode: 0644]
tools/clitkScintivolStats.ggo [new file with mode: 0644]
travis/travis_build_itk.sh
travis/travis_build_qt.sh
travis/travis_build_vtk.sh
vv/CMakeLists.txt
vv/qt_ui/vvMainWindow.ui
vv/qt_ui/vvMainWindowVTK7.ui [new file with mode: 0644]
vv/qt_ui/vvSegmentationDialog.ui
vv/qt_ui/vvSegmentationDialogVTK7.ui [new file with mode: 0644]
vv/qt_ui/vvSurfaceViewerDialog.ui
vv/qt_ui/vvSurfaceViewerDialogVTK7.ui [new file with mode: 0644]
vv/qt_ui/vvToolHistogram.ui
vv/qt_ui/vvToolHistogramVTK7.ui [new file with mode: 0644]
vv/qt_ui/vvToolProfile.ui
vv/qt_ui/vvToolProfileVTK7.ui [new file with mode: 0644]
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvMeshReader.cxx
vv/vvOverlayPanel.cxx
vv/vvQDicomSeriesSelector.cxx
vv/vvQDicomSeriesSelector.h
vv/vvSegmentationDialog.h
vv/vvSlicer.cxx
vv/vvSurfaceViewerDialog.h
vv/vvToolHistogram.cxx
vv/vvToolHistogram.h
vv/vvToolProfile.h

index a1d3ba91e565cff4c73e222b5006d0a8225a95b6..99db61bc90fadc2e0e3110ddcb6a00798637b62c 100644 (file)
@@ -12,51 +12,60 @@ compiler:
     - gcc
     - clang
 env:
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=false
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=false
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false
-    - WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=false
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=true
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=true
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v5.10.0 ITK_VERSION=v4.6.0 QT_VERSION=4.8.7 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=false
+    - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true
+    - WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=true
 
 matrix:
   exclude:
-  - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=false #VTK5.10 doesn't work with osX
-  - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=true #VTK5.10 doesn't work with osX
-  - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false #Qt4 doesn't work with brew anymore
-  - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true #Qt4 doesn't work with brew anymore
-  - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false
-  - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true
+  - os: osx #VTK5.10, Qt4, ITK < 4.13 doesn't work with osX
   - os: linux
-    env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=true #Problem with VTK 5.10 and c++11
+    env: WITH_CMAKE=true VTK_VERSION=v5.10.0 ITK_VERSION=v4.6.0 QT_VERSION=4.8.7 C11=true #Problem with VTK 5.10 and c++11
   - os: linux
     compiler: clang #Remove ITK with clang on linux
   include:
   - os: linux
     compiler: clang
-    env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false
+    env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false
+  - os: linux
+    compiler: clang
+    env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false
   - os: linux
     compiler: clang
-    env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false
+    env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=false
   - os: linux
     compiler: clang
-    env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true
+    env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true
   - os: linux
     compiler: clang
-    env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true
+    env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true
+  - os: linux
+    compiler: clang
+    env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=true
+  - os: osx
+    env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false
+  - os: osx
+    env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false
+  - os: osx
+    env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=flase
+  - os: osx
+    env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true
+  - os: osx
+    env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true
+  - os: osx
+    env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=true
 
 
 language: cpp
@@ -84,16 +93,17 @@ before_install:
 - export cwd=$(pwd)
 - export SCRIPTS=$cwd/travis
 - export EXTERNALS_DIR=$HOME
-- export VTK_SOURCE_DIR=${EXTERNALS_DIR}/vtk-${VTK_VERSION}
-- export VTK_DIR=${EXTERNALS_DIR}/vtk-${VTK_VERSION}-build
-- export ITK_SOURCE_DIR=${EXTERNALS_DIR}/itk-${ITK_VERSION}
-- export ITK_DIR=${EXTERNALS_DIR}/itk-${ITK_VERSION}-build
+- export VTK_SOURCE_DIR=${EXTERNALS_DIR}/vtk
+- export VTK_DIR=${EXTERNALS_DIR}/vtk-build
+- export ITK_SOURCE_DIR=${EXTERNALS_DIR}/itk
+- export ITK_DIR=${EXTERNALS_DIR}/itk-build
 - export BUILD_DIR=$cwd/build
 - if test $TRAVIS_OS_NAME == linux ; then sudo apt-get install -y -qq build-essential cmake; fi
 #Install qt5
 - $SCRIPTS/travis_build_qt.sh
 - if test $TRAVIS_OS_NAME == linux; then sudo apt-get -y install libgdcm2-dev libpq-dev; fi
 - if test $TRAVIS_OS_NAME == linux; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then QTDIR="/opt/qt55" && PATH="$PATH:$QTDIR/bin" && qt55-env.sh ; fi; fi
+- if test $TRAVIS_OS_NAME == linux; then cd $HOME && wget https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.tar.gz && tar -xzf cmake-3.11.4-Linux-x86_64.tar.gz && export PATH=$HOME/cmake-3.11.4-Linux-x86_64/bin:${PATH} ; fi
 - if test $TRAVIS_OS_NAME == osx ; then export HOMEBREW_QT_VERSION=$(brew list --versions qt | rev | cut -d' ' -f1 | rev); fi
 - if test $TRAVIS_OS_NAME == osx ; then brew install ccache; fi
 - if test $TRAVIS_OS_NAME == osx ; then export PATH="/usr/local/opt/qt/bin:/usr/local/opt/ccache/libexec:$PATH"; fi
@@ -101,18 +111,10 @@ before_install:
 
 cache:
  - directories:
-   - $HOME/vtk-5.10
-   - $HOME/vtk-5.10-build
-   - $HOME/vtk-6.3
-   - $HOME/vtk-6.3-build
-   - $HOME/vtk-7.0.0
-   - $HOME/vtk-7.0.0-build
-   - $HOME/itk-4.6
-   - $HOME/itk-4.6-build
-   - $HOME/itk-4.9.1
-   - $HOME/itk-4.9.1-build
-   - $HOME/itk-4.13.0
-   - $HOME/itk-4.13.0-build
+   - $HOME/vtk
+   - $HOME/vtk-build
+   - $HOME/itk
+   - $HOME/itk-build
    - '$HOME/.sonar/cache'
  - timeout: 10000
 
index 8fa4cfc3b15935562fc7c5b898e22ae020f6755d..43d90d02c496d6dba5c3f696a88b195c4b535f0c 100755 (executable)
@@ -207,6 +207,7 @@ function merge_doseByRegions {
     echo "  ${indent}creating ${merged}"
     local count=0
     start_bar $#
+    source ${doseMerger}
     while test $# -gt 0
     do
         local partial="$1"
@@ -217,12 +218,14 @@ function merge_doseByRegions {
         then
             update_bar ${count} "copying first partial result ${partial}"
             cp "${partial}" "${merged}"
+            copyFirstPartialResult -i "${merged}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}"
             continue
         fi
 
         update_bar ${count} "adding ${partial}"
-        ${doseMerger} -i "${merged}" -j "${partial}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}"
+        addToPartialResult -i "${merged}" -j "${partial}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}"
     done
+    divideUncertaintyResult -i "${merged}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}"
     end_bar
     echo "  ${indent}merged ${count} files"
 }
index d7a390af7fa194b5671d927bad94cd82a3bae0fd..b9303aac008b3b3a55a77bf4808531ad1c9e56b6 100755 (executable)
 set -u
 
 function usage {
-  echo "$0 -i <file1> -j <file2> -o <result>"
+  echo "$0 -i <result> -j <file2> -o <result>"
   exit 1
 }
 
-if [ $# != 6 ]
-then
-  usage
-fi
+function addToPartialResult {
+  IN1=$2 #merged file for previous jobs
+  IN2=$4 # current job
+  RESULT=$6 #output merged file
 
-IN1=$2
-IN2=$4
-RESULT=$6
+  test -f ${IN1} && test -f ${IN2} || usage
 
-test -f ${IN1} && test -f ${IN2} || usage
+  TMP="$(mktemp)"
 
-TMP="$(mktemp)"
-echo "merging dose by regions file"
-# check if all 3 text files have the same number of lines
-nblines=`cat ${IN1} | wc -l`
-nb2=`cat ${IN2} | wc -l`
-nb3=`cat ${RESULT} | wc -l`
+  # check if all 3 text files have the same number of lines
+  nblines=`cat ${IN1} | wc -l`
+  nb2=`cat ${IN2} | wc -l`
+  nb3=`cat ${RESULT} | wc -l`
 
-if [ $nblines -ne $nb2 ] || [ $nblines -ne $nb3 ]; then
-  echo "Files does not have the same size"
-  exit 1
-fi
-
-#Copy the 1st line in output
-line1=`sed -n "1p" < ${RESULT}`
-echo "${line1}" >> ${TMP}
-
-# for all lines (except the 1st), split according tab
-# sum the some elements (dose, edep) ...
-for i in $(seq 2 $nblines); do
-  #Get the 3 lines
-  line1=`sed -n "${i}p" < ${IN1}`
-  line2=`sed -n "${i}p" < ${IN2}`
-  line3=`sed -n "${i}p" < ${RESULT}`
-
-  # sum edep: get the 2 values, sum them and replace it in the line3
-  # The /#./0. is important to add 0 for decimal value between 0 and 1
-  edep1=$(echo ${line1} | cut -f3 -d' ')
-  edep2=$(echo ${line2} | cut -f3 -d' ')
-  edep3=$(echo "scale=30;$edep1+$edep2" | bc)
-  edep3=${edep3/#./0.}
-  line3=$(echo $line3 |awk -v r=${edep3} '{$3=r}1')
-
-  # sqrt sum square std_edep: get the 2 values, sum the square, take the sqrt and replace it in the line3
-  edep1=$(echo ${line1} | cut -f4 -d' ')
-  edep2=$(echo ${line2} | cut -f4 -d' ')
-  edep3=$(echo "scale=30;sqrt($edep1*$edep1+$edep2*$edep2)" | bc)
-  edep3=${edep3/#./0.}
-  line3=$(echo $line3 |awk -v r=${edep3} '{$4=r}1')
-
-  # sum square_edep: get the 2 values, sum them and replace it in the line3
-  edep1=$(echo ${line1} | cut -f5 -d' ')
-  edep2=$(echo ${line2} | cut -f5 -d' ')
-  edep3=$(echo "scale=30;$edep1+$edep2" | bc)
-  edep3=${edep3/#./0.}
-  line3=$(echo $line3 |awk -v r=${edep3} '{$5=r}1')
-
-  # sum dose: get the 2 values, sum them and replace it in the line3
-  edep1=$(echo ${line1} | cut -f6 -d' ')
-  edep2=$(echo ${line2} | cut -f6 -d' ')
-  edep3=$(echo "scale=30;$edep1+$edep2" | bc)
-  edep3=${edep3/#./0.}
-  line3=$(echo $line3 |awk -v r=${edep3} '{$6=r}1')
-
-  # sqrt sum square std_dose: get the 2 values, sum the square, take the sqrt and replace it in the line3
-  edep1=$(echo ${line1} | cut -f7 -d' ')
-  edep2=$(echo ${line2} | cut -f7 -d' ')
-  edep3=$(echo "scale=30;sqrt($edep1*$edep1+$edep2*$edep2)" | bc)
-  edep3=${edep3/#./0.}
-  line3=$(echo $line3 |awk -v r=${edep3} '{$7=r}1')
-
-  # sum square_dose: get the 2 values, sum them and replace it in the line3
-  edep1=$(echo ${line1} | cut -f8 -d' ')
-  edep2=$(echo ${line2} | cut -f8 -d' ')
-  edep3=$(echo "scale=30;$edep1+$edep2" | bc)
-  edep3=${edep3/#./0.}
-  line3=$(echo $line3 |awk -v r=${edep3} '{$8=r}1')
-
-  # sum n_hits: get the 2 values, sum them and replace it in the line3
-  edep1=$(echo ${line1} | cut -f9 -d' ')
-  edep2=$(echo ${line2} | cut -f9 -d' ')
-  edep3=$(echo "scale=30;$edep1+$edep2" | bc)
-  line3=$(echo $line3 |awk -v r=${edep3} '{$9=r}1')
-
-  # sum n_event_hits: get the 2 values, sum them and replace it in the line3
-  edep1=$(echo ${line1} | cut -f10 -d' ')
-  edep2=$(echo ${line2} | cut -f10 -d' ')
-  edep3=$(echo "scale=30;$edep1+$edep2" | bc)
-  line3=$(echo $line3 |awk -v r=${edep3} '{$10=r}1')
-
-  #Write the output
-  echo "${line3}" >> ${TMP}
-done
-mv -f ${TMP} ${RESULT}
+  if [ $nblines -ne $nb2 ] || [ $nblines -ne $nb3 ]; then
+    echo "Files does not have the same size"
+    exit 1
+  fi
+
+  # Find the number of primaries for this job (the same for all line and different of 0)
+  # Get the number of primaries from edep and square_edep to determine the std.
+  nbPrimary=0
+  for i in $(seq 2 $nblines); do
+    #Get the line
+    file2=`sed -n "${i}p" < ${IN2}`
+
+    edep2=$(echo ${file2} | cut -f3 -d' ')
+    stdEdep2=$(echo ${file2} | cut -f4 -d' ')
+    sqEdep2=$(echo ${file2} | cut -f5 -d' ')
+    nbPrimary=$(python <<EOP
+if ($edep2 == 0 or $sqEdep2 == 0):
+  print(0)
+else:
+  temp=pow($edep2,2)*(pow($stdEdep2,2)-1)/(pow($stdEdep2*$edep2,2)-$sqEdep2)
+  print(int(round(temp)))
+EOP
+    )
+    if [ $nbPrimary -ne 0 ]; then
+      break
+    fi
+
+    dose2=$(echo ${file2} | cut -f6 -d' ')
+    stdDose2=$(echo ${file2} | cut -f7 -d' ')
+    sqDose2=$(echo ${file2} | cut -f8 -d' ')
+    nbPrimary=$(python <<EOP
+if ($dose2 == 0 or $sqDose2 == 0):
+  print(0)
+else:
+  temp=pow($dose2,2)*(pow($stdDose2,2)-1)/(pow($stdDose2*$dose2,2)-$sqDose2)
+  print(int(round(temp)))
+EOP
+    )
+    if [ $nbPrimary -ne 0 ]; then
+      break
+    fi
+  done
+
+  #Copy the 1st line in output
+  line1=`sed -n "1p" < ${RESULT}`
+  echo "${line1}" >> ${TMP}
+  # for all lines (except the 1st), split according tab
+  # sum the some elements (dose, edep) ...
+  for i in $(seq 2 $nblines); do
+    #Get the 3 lines
+    file1=`sed -n "${i}p" < ${IN1}`
+    file2=`sed -n "${i}p" < ${IN2}`
+    file3=`sed -n "${i}p" < ${RESULT}`
+
+    # sum edep: get the 2 values, sum them and replace it in the file3
+    # The /#./0. is important to add 0 for decimal value between 0 and 1
+    edep1=$(echo ${file1} | cut -f3 -d' ')
+    edep2=$(echo ${file2} | cut -f3 -d' ')
+    edep3=$(python -c "print($edep1+$edep2)")
+    edep3=${edep3/#./0.}
+    file3=$(echo $file3 |awk -v r=${edep3} '{$3=r}1')
+
+    # sum square_edep: get the 2 values, sum them and replace it in the file3
+    sqEdep1=$(echo ${file1} | cut -f5 -d' ')
+    sqEdep2=$(echo ${file2} | cut -f5 -d' ')
+    sqEdep3=$(python -c "print($sqEdep1+$sqEdep2)")
+    sqEdep3=${sqEdep3/#./0.}
+    file3=$(echo $file3 |awk -v r=${sqEdep3} '{$5=r}1')
+
+    # Get the number of primaries from edep and square_edep to determine the std.
+    # Sum the number of primaries with the latter ones
+    nbPrimaryEdep1=$(echo ${file1} | cut -f4 -d' ')
+    nbPrimaryEdep3=$(python <<EOP
+print($nbPrimary+$nbPrimaryEdep1)
+EOP
+    )
+    nbPrimaryEdep3=${nbPrimaryEdep3/#./0.}
+    file3=$(echo $file3 |awk -v r=${nbPrimaryEdep3} '{$4=r}1')
+
+    # sum dose: get the 2 values, sum them and replace it in the file3
+    dose1=$(echo ${file1} | cut -f6 -d' ')
+    dose2=$(echo ${file2} | cut -f6 -d' ')
+    dose3=$(python -c "print($dose1+$dose2)")
+    dose3=${dose3/#./0.}
+    file3=$(echo $file3 |awk -v r=${dose3} '{$6=r}1')
+
+    # sum square_dose: get the 2 values, sum them and replace it in the file3
+    sqDose1=$(echo ${file1} | cut -f8 -d' ')
+    sqDose2=$(echo ${file2} | cut -f8 -d' ')
+    sqDose3=$(python -c "print($sqDose1+$sqDose2)")
+    sqDose3=${sqDose3/#./0.}
+    file3=$(echo $file3 |awk -v r=${sqDose3} '{$8=r}1')
+
+    # Get the number of primaries from dose and square_dose to determine the std.
+    # Sum the number of primaries with the latter ones
+    nbPrimaryDose1=$(echo ${file1} | cut -f7 -d' ')
+    stdDose2=$(echo ${file2} | cut -f7 -d' ')
+    nbPrimaryDose3=$(python <<EOP
+print($nbPrimary+$nbPrimaryDose1)
+EOP
+    )
+    nbPrimaryDose3=${nbPrimaryDose3/#./0.}
+    file3=$(echo $file3 |awk -v r=${nbPrimaryDose3} '{$7=r}1')
+
+    # sum n_hits: get the 2 values, sum them and replace it in the file3
+    hit1=$(echo ${file1} | cut -f9 -d' ')
+    hit2=$(echo ${file2} | cut -f9 -d' ')
+    hit3=$(python -c "print($hit1+$hit2)")
+    file3=$(echo $file3 |awk -v r=${hit3} '{$9=r}1')
+
+    # sum n_event_hits: get the 2 values, sum them and replace it in the file3
+    event1=$(echo ${file1} | cut -f10 -d' ')
+    event2=$(echo ${file2} | cut -f10 -d' ')
+    event3=$(python -c "print($event1+$event2)")
+    file3=$(echo $file3 |awk -v r=${event3} '{$10=r}1')
+
+    #Write the output
+    echo "${file3}" >> ${TMP}
+  done
+  mv -f ${TMP} ${RESULT}
+}
+
+function copyFirstPartialResult {
+  IN1=$2
+  RESULT=$4
+
+  TMP="$(mktemp)"
+
+  # check if all 2 text files have the same number of lines
+  nblines=`cat ${IN1} | wc -l`
+  nb3=`cat ${RESULT} | wc -l`
+
+  if [ $nblines -ne $nb3 ]; then
+    echo "Files does not have the same size"
+    exit 1
+  fi
+  # Find the number of primaries for this job (the same for all line and different of 0)
+  # Get the number of primaries from edep and square_edep to determine the std.
+  nbPrimary=0
+  for i in $(seq 2 $nblines); do
+    #Get the line
+    file2=`sed -n "${i}p" < ${IN1}`
+
+    edep2=$(echo ${file2} | cut -f3 -d' ')
+    stdEdep2=$(echo ${file2} | cut -f4 -d' ')
+    sqEdep2=$(echo ${file2} | cut -f5 -d' ')
+    nbPrimary=$(python <<EOP
+if ($edep2 == 0 or $sqEdep2 == 0):
+  print(0)
+else:
+  temp=pow($edep2,2)*(pow($stdEdep2,2)-1)/(pow($stdEdep2*$edep2,2)-$sqEdep2)
+  print(int(round(temp)))
+EOP
+    )
+    if [ $nbPrimary -ne 0 ]; then
+      break
+    fi
+
+    dose2=$(echo ${file2} | cut -f6 -d' ')
+    stdDose2=$(echo ${file2} | cut -f7 -d' ')
+    sqDose2=$(echo ${file2} | cut -f8 -d' ')
+    nbPrimary=$(python <<EOP
+if ($dose2 == 0 or $sqDose2 == 0):
+  print(0)
+else:
+  temp=pow($dose2,2)*(pow($stdDose2,2)-1)/(pow($stdDose2*$dose2,2)-$sqDose2)
+  print(int(round(temp)))
+EOP
+    )
+    if [ $nbPrimary -ne 0 ]; then
+      break
+    fi
+  done
+
+  #Copy the 1st line in output
+  line1=`sed -n "1p" < ${RESULT}`
+  echo "${line1}" >> ${TMP}
+  # for all lines (except the 1st), split according tab
+  # write the number of primaries
+  for i in $(seq 2 $nblines); do
+    #Get the lines
+    file3=`sed -n "${i}p" < ${RESULT}`
+
+    file3=$(echo $file3 |awk -v r=${nbPrimary} '{$4=r}1')
+    file3=$(echo $file3 |awk -v r=${nbPrimary} '{$7=r}1')
+
+    #Write the output
+    echo "${file3}" >> ${TMP}
+  done
+  mv -f ${TMP} ${RESULT}
+}
+
+function divideUncertaintyResult {
+  IN1=$2
+  RESULT=$4
+
+  TMP="$(mktemp)"
+
+  # check if all 2 text files have the same number of lines
+  nblines=`cat ${IN1} | wc -l`
+  nb3=`cat ${RESULT} | wc -l`
+
+  if [ $nblines -ne $nb3 ]; then
+    echo "Files does not have the same size"
+    exit 1
+  fi
+
+  #Copy the 1st line in output
+  line1=`sed -n "1p" < ${RESULT}`
+  echo "${line1}" >> ${TMP}
+  # for all lines (except the 1st), split according tab
+  # sum the some elements (dose, edep) ...
+  for i in $(seq 2 $nblines); do
+    #Get the lines
+    file1=`sed -n "${i}p" < ${IN1}`
+    file3=`sed -n "${i}p" < ${RESULT}`
+
+    # Divide uncertainty and replace it in the file3
+    edep1=$(echo ${file1} | cut -f3 -d' ')
+    nbPrimaryEdep1=$(echo ${file1} | cut -f4 -d' ')
+    sqEdep1=$(echo ${file1} | cut -f5 -d' ')
+    stdEdep3=$(python <<EOP
+import math
+if ($edep1 == 0 or $sqEdep1 == 0):
+  print(1.0)
+else:
+  temp=math.sqrt(($sqEdep1/$nbPrimaryEdep1-pow($edep1/$nbPrimaryEdep1, 2))/($nbPrimaryEdep1-1))/($edep1/$nbPrimaryEdep1)
+  print(temp)
+EOP
+    )
+    stdEdep3=${stdEdep3/#./0.}
+    file3=$(echo $file3 |awk -v r=${stdEdep3} '{$4=r}1')
+
+    # Divide uncertainty and replace it in the file3
+    dose1=$(echo ${file1} | cut -f6 -d' ')
+    nbPrimaryDose1=$(echo ${file1} | cut -f7 -d' ')
+    sqDose1=$(echo ${file1} | cut -f8 -d' ')
+    stdDose3=$(python <<EOP
+import math
+if ($edep1 == 0 or $sqEdep1 == 0):
+  print(1.0)
+else:
+  temp=math.sqrt(($sqDose1/$nbPrimaryDose1-pow($dose1/$nbPrimaryDose1, 2))/($nbPrimaryDose1-1))/($dose1/$nbPrimaryDose1)
+  print(temp)
+EOP
+    )
+    stdDose3=${stdDose3/#./0.}
+    file3=$(echo $file3 |awk -v r=${stdDose3} '{$7=r}1')
+
+    #Write the output
+    echo "${file3}" >> ${TMP}
+  done
+  mv -f ${TMP} ${RESULT}
+}
 
index 88e1289351a2badbd15979a7e634aa9849192ed9..72f711fb43152f678666fbaf45568609d3964106 100644 (file)
@@ -21,7 +21,7 @@
 #include "clitkCommon.h"
 
 // itk include
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 // IMPLEMENTATION NOTE:
 // The following has been done without the use of vtkGDCMImageReader which directly
 // handle RTDOSE image. Another approach would have been to use gdcm::ImageReader
@@ -56,7 +56,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
   int rc;
 #endif
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   m_GdcmImageReader.SetFileName(m_FileName.c_str());
   m_GdcmImageReader.Read();
   gdcm::File* m_GdcmFile = &m_GdcmImageReader.GetFile();
@@ -68,7 +68,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 #endif
 
   /* Modality -- better be RTSTRUCT */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::DataSet &ds = m_GdcmFile->GetDataSet();
 
   gdcm::Attribute<0x8,0x60> at1;
@@ -82,7 +82,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
   }
 
   /* ImagePositionPatient */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Attribute<0x20,0x32> at2;
   at2.SetFromDataSet(ds);
   ipp[0] = at2.GetValue(0);
@@ -97,7 +97,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 #endif
 
   /* Rows */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Attribute<0x28,0x10> at3;
   at3.SetFromDataSet(ds);
   dim[1] = at3.GetValue();
@@ -110,7 +110,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 #endif
 
   /* Columns */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Attribute<0x28,0x11> at4;
   at4.SetFromDataSet(ds);
   dim[0] = at4.GetValue();
@@ -123,7 +123,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 #endif
 
   /* PixelSpacing */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Attribute<0x28,0x30> at5;
   at5.SetFromDataSet(ds);
   spacing[0] = at5.GetValue(0);
@@ -137,7 +137,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 #endif
 
   /* GridFrameOffsetVector */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Attribute<0x3004,0x000C> at6;
   const gdcm::DataElement& de6 = ds.GetDataElement( at6.GetTag() );
   at6.SetFromDataElement(de6);
@@ -198,7 +198,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 #endif
 
   /* DoseGridScaling */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Attribute<0x3004,0x000E> at7 = { 1. } ;
   at7.SetFromDataSet(ds);
   m_DoseScaling = at7.GetValue();
@@ -228,7 +228,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation()
 // Read Image Information
 bool clitk::DicomRTDoseIO::CanReadFile(const char* FileNameToRead)
 {
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Reader creader;
   creader.SetFileName(FileNameToRead);
   if (!creader.Read())
@@ -279,7 +279,7 @@ void clitk::DicomRTDoseIO::Read(void * buffer)
     npix *= GetDimensions(i);
 
   /* PixelData */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Image &i = m_GdcmImageReader.GetImage();
   
   char* image_data = new char[i.GetBufferLength()];
index 2f08938c11824ac45c3517d95237b75b1c234e54..dbcafe1da492a17b6f047d00cc6b5c9ffb357e11 100644 (file)
@@ -24,7 +24,7 @@
 // itk include
 #include <itkImageIOBase.h>
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   #include <gdcmImageReader.h>
 #endif
 
@@ -77,7 +77,7 @@ protected:
   bool mustWriteHeader;
   int m_HeaderSize;
   std::ofstream file;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::ImageReader m_GdcmImageReader;
 #else
   gdcm::File *m_GdcmFile;
index 28fd054102ab0d62ed6ecdd32653bed7bf03d3fb..9a5042befdef6b7b14f63a86d8e23aa42e290704 100644 (file)
@@ -20,7 +20,7 @@
 #include "clitkDicomRT_Contour.h"
 #include <vtkCellArray.h>
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include "gdcmAttribute.h"
 #include "gdcmItem.h"
 #endif
@@ -53,7 +53,7 @@ void clitk::DicomRT_Contour::Print(std::ostream & os) const
 
 
 //--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 void clitk::DicomRT_Contour::UpdateDicomItem()
 {
   DD("DicomRT_Contour::UpdateDicomItem");
@@ -119,7 +119,7 @@ void clitk::DicomRT_Contour::UpdateDicomItem()
 
 
 //--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 bool clitk::DicomRT_Contour::Read(gdcm::Item * item)
 {
   mItem = item;
index 077599f29da2bc84024bdf04625b5b25d4c74cb0..ab6db0d27d37565f99dc4dacb6db80e3b04a9948 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "clitkCommon.h" 
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #else
 #include <gdcm.h>
 #include <gdcmSQItem.h>
@@ -44,7 +44,7 @@ public:
 
   void Print(std::ostream & os = std::cout) const;
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   bool Read(gdcm::Item * item);
   void UpdateDicomItem();
 #else
@@ -71,7 +71,7 @@ protected:
   ///Z location of the contour
   double mZ;
   
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Item * mItem;
 #else
   gdcm::SQItem * mItem;
index 4135b3178026941f492c1c5a0d021d8e22248719..d8af8c313e10cbd64a5ae92d649f4001ea9f6ce9 100644 (file)
@@ -25,7 +25,7 @@
 #include <vtkPolyDataWriter.h>
 #include <vtkVersion.h>
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include "gdcmAttribute.h"
 #include "gdcmItem.h"
 #endif
@@ -148,7 +148,7 @@ double clitk::DicomRT_ROI::GetForegroundValueLabelImage() const
 
 
 //--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 bool clitk::DicomRT_ROI::Read(gdcm::Item * itemInfo, gdcm::Item * itemContour)
 {
   //FATAL("Error : compile vv with itk4 + external gdcm");
@@ -302,7 +302,7 @@ void clitk::DicomRT_ROI::ComputeMeshFromContour()
 //--------------------------------------------------------------------
 
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 //--------------------------------------------------------------------
 void clitk::DicomRT_ROI::UpdateDicomItem()
 {
index ec43538aefffc95ab9f0e18f40e025d1a204e2b8..b41793323bb67b1795da94f21050f75e3ab04b68 100644 (file)
@@ -79,7 +79,7 @@ public:
   void SetName(std::string n) { mName = n; }
 
   // Read from DICOM RT STRUCT
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour);
   void UpdateDicomItem();
 #else
@@ -104,7 +104,7 @@ protected:
   double mForegroundValue;
   bool m_DicomUptodateFlag;
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Item * mItemInfo;
   gdcm::Item * mItemContour;
   gdcm::SmartPointer<gdcm::SequenceOfItems> mContoursSequenceOfItems;
index 49d90bd78afbb926228dd0592ae4df4d0c79b4ee..a845ef55b97cc6a789a7c63b72bb9ce2a805a091 100644 (file)
@@ -239,7 +239,7 @@ void clitk::DicomRT_StructureSet::Print(std::ostream & os) const
 //--------------------------------------------------------------------
 
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 //--------------------------------------------------------------------
 int clitk::DicomRT_StructureSet::ReadROINumber(const gdcm::Item & item)
 {
@@ -255,7 +255,7 @@ int clitk::DicomRT_StructureSet::ReadROINumber(const gdcm::Item & item)
 //--------------------------------------------------------------------
 void clitk::DicomRT_StructureSet::Write(const std::string & filename)
 {
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 
   // Assert that the gdcm file is still open (we can write only if it was readed)
   if (mFile == NULL) {
@@ -461,7 +461,7 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename)
 bool clitk::DicomRT_StructureSet::IsDicomRTStruct(const std::string & filename)
 {
   // Open DICOM
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // Read gdcm file
   mReader = new gdcm::Reader;
   mReader->SetFileName(filename.c_str());
index 7932051cc44aeffdeda4b530e934b7b42a333396..dff4d75276aa3196dca59941661007f7da497733 100644 (file)
@@ -38,7 +38,7 @@
 #endif
 
 // gdcm
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 // This is not use if CLITK_USE_SYSTEM_GDCM==1
 #include "gdcmReader.h"
 #include "gdcmWriter.h"
@@ -81,7 +81,7 @@ public:
 
   int AddBinaryImageAsNewROI(vvImage * i, std::string name);
   
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // Static
   static int ReadROINumber(const gdcm::Item & item);
 #endif
@@ -98,7 +98,7 @@ protected:
 
   std::map<int, clitk::DicomRT_ROI::Pointer> mROIs;
   std::map<int, std::string> mMapOfROIName;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Reader * mReader;
   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIInfoSequenceOfItems;
   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIContoursSequenceOfItems;  
index c4f081287b2b469176c15352bc5c902a2240d866..e876f9fd6e042ba29a134f1f9cb709fdbe09f891 100644 (file)
@@ -169,8 +169,11 @@ namespace itk
       }
     }
   
-
-    virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE;
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+#else
+   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE;
+#endif
     void EnlargeOutputRequestedRegion (DataObject * output) ITK_OVERRIDE;
 
   protected:
index eee0f0a748c95a99e63def5712a0c166ee50dbb0..c34c7c3f2241a1492fb014d71af8b00413b33144 100644 (file)
@@ -50,7 +50,11 @@ namespace itk
   template <class TInputImage, class TOutputImage,class TtNorm>
   void 
   RelativePositionPropImageFilter<TInputImage,TOutputImage,TtNorm>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  ::GenerateInputRequestedRegion()
+#else
   ::GenerateInputRequestedRegion() throw (InvalidRequestedRegionError)
+#endif
   {
     // call the superclass' implementation of this method
     Superclass::GenerateInputRequestedRegion ();
index 8ff8def40ec2cbf344ee7d4bd643d20d4f680623..9ffaffbeb3521ee85a092a0cb56ef2e6495b016f 100644 (file)
@@ -210,7 +210,11 @@ namespace clitk
     void SetOutputParametersFromImage( const OutputImageConstPointer  image );
 
 
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+    void Initialize(void);
+#else
     void Initialize(void) throw (itk::ExceptionObject);
+#endif
 
   protected:
 
index f98129145b95fcbc31c794f89618881df80f5cf7..fa8d2613fec8815c80ae08abc3046a4000f65c81 100644 (file)
@@ -190,7 +190,11 @@ namespace clitk
   template <class InputImageType, class OutputImageType>
   void 
   BackProjectImageFilter<InputImageType, OutputImageType>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  ::Initialize( void )
+#else
   ::Initialize( void ) throw (itk::ExceptionObject)
+#endif
   {
     //Change the origin of the 2D input
     typename  InputImageType::ConstPointer inputPtr=this->GetInput();
index 85a5c22605a46e89f8a2def0c6396138a5271f40..7efac8fc8268291bd3564fb0a1a03045a9744cbb 100644 (file)
@@ -71,10 +71,18 @@ namespace clitk
     itkSetMacro( Verbose, bool);
     itkSetMacro( EdgePaddingValue, PixelType );
     itkSetMacro( DeformationField, typename DeformationFieldType::Pointer);
+#if ITK_VERSION_MAJOR <= 4
     void SetNumberOfThreads(unsigned int r )
+#else
+    void SetNumberOfWorkUnits(unsigned int r )
+#endif
     {
       m_NumberOfThreadsIsGiven=true;
+#if ITK_VERSION_MAJOR <= 4
       m_NumberOfThreads=r;
+#else
+      m_NumberOfWorkUnits=r;
+#endif
     }
     itkSetMacro(ThreadSafe, bool);
  
@@ -102,7 +110,11 @@ namespace clitk
   private:
     bool m_Verbose;
     bool m_NumberOfThreadsIsGiven;
+#if ITK_VERSION_MAJOR <= 4
     unsigned int m_NumberOfThreads;
+#else
+    unsigned int m_NumberOfWorkUnits;
+#endif
     PixelType m_EdgePaddingValue;
     typename DeformationFieldType::Pointer m_DeformationField;
     bool m_ThreadSafe;
index f5e98536516cb5e1657d577c50b1c8bff54d1687..4d49b4dd7e98cf9d5797fcc4127eb29d86963614 100644 (file)
@@ -445,7 +445,13 @@ void ForwardWarpImageFilter<InputImageType, OutputImageType, DeformationFieldTyp
   typename HelperClass1Type::Pointer helper1=HelperClass1Type::New();
 
   //Set input
-  if(m_NumberOfThreadsIsGiven)helper1->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper1->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper1->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper1->SetInput(inputPtr);
   helper1->SetDeformationField(m_DeformationField);
   helper1->SetWeights(weights);
@@ -478,7 +484,13 @@ void ForwardWarpImageFilter<InputImageType, OutputImageType, DeformationFieldTyp
   typename HelperClass2Type::Pointer helper2=HelperClass2Type::New();
 
   //Set temporary output as input
-  if(m_NumberOfThreadsIsGiven)helper2->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper2->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper2->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper2->SetInput(temp);
   helper2->SetWeights(weights);
   helper2->SetEdgePaddingValue(m_EdgePaddingValue);
index 52edcd922238be7a444694d062d66b593b2df5c1..8ad84a2e969c6ba75ed7da41dbe50676b4ab6a0b 100644 (file)
@@ -65,10 +65,18 @@ namespace clitk
     //Set Methods(inline)
     itkSetMacro( Verbose, bool);
     itkSetMacro( EdgePaddingValue, PixelType );
+#if ITK_VERSION_MAJOR <= 4
     void SetNumberOfThreads(unsigned int r ) ITK_OVERRIDE
+#else
+    void SetNumberOfWorkUnits(unsigned int r ) ITK_OVERRIDE
+#endif
     {
       m_NumberOfThreadsIsGiven=true;
+#if ITK_VERSION_MAJOR <= 4
       m_NumberOfThreads=r;
+#else
+      m_NumberOfWorkUnits=r;
+#endif
     }
     itkSetMacro(ThreadSafe, bool);
     itkSetMacro(OutputSpacing, SpacingType);
@@ -84,7 +92,11 @@ namespace clitk
     bool m_NumberOfThreadsIsGiven;
     SpacingType m_OutputSpacing;
     SizeType m_OutputSize;
+#if ITK_VERSION_MAJOR <= 4
     unsigned int m_NumberOfThreads;
+#else
+    unsigned int m_NumberOfWorkUnits;
+#endif
     PixelType m_EdgePaddingValue;
     bool m_ThreadSafe;
   };
index 4b982308cf2afcf906e0fd955f2bbad3c8b27be6..b2485e0e51a5f6c260c3aeed26cfc5575c396543 100644 (file)
@@ -438,7 +438,13 @@ template <class InputImageType, class OutputImageType> void InvertVFFilter<Input
   typename HelperClass1Type::Pointer helper1=HelperClass1Type::New();
 
   //Set input
-  if(m_NumberOfThreadsIsGiven)helper1->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper1->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper1->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper1->SetInput(inputPtr);
   helper1->SetWeights(weights);
 
@@ -468,7 +474,13 @@ template <class InputImageType, class OutputImageType> void InvertVFFilter<Input
   typename HelperClass2Type::Pointer helper2=HelperClass2Type::New();
 
   //Set temporary output as input
-  if(m_NumberOfThreadsIsGiven)helper2->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper2->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper2->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper2->SetInput(temp);
   helper2->SetWeights(weights);
   helper2->SetEdgePaddingValue(m_EdgePaddingValue);
index 348d85898035db8dedf310c8a078293dedeb76c9..2a3f99d05ae182ac4c2361fd71cb3c9fb4360aa6 100644 (file)
@@ -15,7 +15,7 @@ namespace clitk
   PasteImageFilter< TInputImage, TSourceImage, TOutputImage >
   ::PasteImageFilter()
   {
-    this->ProcessObject::SetNumberOfRequiredInputs(2);
+    //this->ProcessObject::SetNumberOfRequiredInputs(2);
 
     this->InPlaceOff();
     this->m_DestinationIndex.Fill(0);
index 4c949cec33eff1ade7b4fe43cfac3f4bf313a1fe..97f6f418c56bc88c0937079060002285d5184758 100644 (file)
@@ -224,7 +224,11 @@ GenerateData()
     case B_LUT: std::cout << "B-LUT " << m_BSplineOrder << " " << m_BLUTSamplingFactor << std::endl; break;
     case WSINC: std::cout << "Windowed Sinc" << std::endl; break;
     }
+#if ITK_VERSION_MAJOR <= 4
     std::cout << "Threads        = " << this->GetNumberOfThreads() << std::endl;
+#else
+    std::cout << "Threads        = " << this->GetNumberOfWorkUnits() << std::endl;
+#endif
     std::cout << "LastDimIsTime  = " << m_LastDimensionIsTime << std::endl;
   }
 
@@ -241,7 +245,11 @@ GenerateData()
   filter->SetOutputSpacing(m_OutputSpacing);
   filter->SetOutputOrigin(m_OutputOrigin);
   filter->SetDefaultPixelValue(m_DefaultPixelValue);
+#if ITK_VERSION_MAJOR <= 4
   filter->SetNumberOfThreads(this->GetNumberOfThreads());
+#else
+  filter->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits());
+#endif
   filter->SetOutputDirection(m_OutputDirection); // <-- NEEDED if we want to keep orientation (in case of PermutAxes for example)
 
   // Select interpolator
index 4ad12a4da9cad661689599df63e966ffd7f7ddb1..91f1e26115d2d98cb8de27a6c8c880c2d2751105 100644 (file)
@@ -1,16 +1,16 @@
 #=========================================================
 
+if(CLITK_BUILD_REGISTRATION)
 # Add Libraries used in vv and clitk to avoid recompilation
-WRAP_GGO(clitkAffineRegistration_GGO_C clitkAffineRegistration.ggo)
-add_library(clitkAffineRegistrationLib
-            clitkAffineRegistrationGenericFilter.cxx
-            ${clitkAffineRegistration_GGO_C}
-            clitkLBFGSBOptimizer.cxx
-            clitkGenericAffineTransform.cxx)
+    WRAP_GGO(clitkAffineRegistration_GGO_C clitkAffineRegistration.ggo)
+    add_library(clitkAffineRegistrationLib
+                clitkAffineRegistrationGenericFilter.cxx
+                ${clitkAffineRegistration_GGO_C}
+                clitkLBFGSBOptimizer.cxx
+                clitkGenericAffineTransform.cxx)
 
 #=========================================================
 
-if(CLITK_BUILD_REGISTRATION)
     ############################## registration algorithms
     add_executable(clitkAffineRegistration clitkAffineRegistration.cxx)
     target_link_libraries(clitkAffineRegistration  clitkAffineRegistrationLib clitkCommon)
index 17ebca95a720d5ec84b78286672fbdae2340dd05..d034912f7eea9497942f11d63100bfcde79e2760 100644 (file)
@@ -393,7 +393,13 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType()
   typename  MetricType::Pointer metric=genericMetric->GetMetricPointer();
   if (movingMask) metric->SetMovingImageMask(movingMask);
 
-  if (threadsGiven) metric->SetNumberOfThreads( threads );
+  if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    metric->SetNumberOfThreads( threads );
+#else
+    metric->SetNumberOfWorkUnits( threads );
+#endif
+  }
 
   //============================================================================
   // Initialize using image moments.
index 35ac6eb9e58b52d5baa09d255108657b83beaf8b..24d461361f9e27a232e54a9e3fcfd757de02f8db 100644 (file)
@@ -649,7 +649,11 @@ namespace clitk
       typename  MetricType::Pointer metric=genericMetric->GetMetricPointer();
       if (movingMask) metric->SetMovingImageMask(movingMask);
       if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
         metric->SetNumberOfThreads( threads );
+#else
+        metric->SetNumberOfWorkUnits( threads );
+#endif
         if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl;
       }
 
@@ -675,7 +679,11 @@ namespace clitk
       registration->SetInterpolator(  interpolator  );
       registration->SetTransform (regTransform );
       if(threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
         registration->SetNumberOfThreads(threads);
+#else
+        registration->SetNumberOfWorkUnits(threads);
+#endif
         if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl;
       }
       registration->SetFixedImage(  croppedFixedImage   );
@@ -793,7 +801,11 @@ namespace clitk
       typedef itk::TransformToDisplacementFieldFilter<DisplacementFieldType, double> ConvertorType;
 #endif
       typename ConvertorType::Pointer filter= ConvertorType::New();
+#if ITK_VERSION_MAJOR <= 4
       filter->SetNumberOfThreads(1);
+#else
+      filter->SetNumberOfWorkUnits(1);
+#endif
       if(m_ArgsInfo.itkbspline_flag)
         sTransform->SetBulkTransform(ITK_NULLPTR);
       else
index 04a6a3737470da8629af3c786502a3f1eeb30446..a4bc342ae230450900ffe0c4fb16a85cbfe8e346 100644 (file)
@@ -105,7 +105,11 @@ public:
     *  (1) making sure that all the components are present and plugged
     *      together correctly,
     *  (3) allocate memory for bin data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  virtual void Initialize(void) ITK_OVERRIDE;
+#else
   virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const TransformParametersType & parameters,
index b52c077c95ac352de10509a02ac53dcfa44d4d9f..1454539c8183b24d2d56a8239d027061076732d9 100644 (file)
@@ -51,7 +51,11 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+::Initialize(void)
+#else
 ::Initialize(void) throw ( ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
index d4b0cb238c55665da8b57e9d9cc52f57bd0e1090..0c49dd790d771d481282ebf73c49d8f7de95d8d2 100644 (file)
@@ -335,7 +335,13 @@ namespace clitk
     // =======================================================
     // The multiresolution scheme
     // =======================================================
-    if (threadsGiven) multiResolutionFilter->SetNumberOfThreads(threads);
+    if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+      multiResolutionFilter->SetNumberOfThreads(threads);
+#else
+      multiResolutionFilter->SetNumberOfWorkUnits(threads);
+#endif
+    }
     unsigned int nLevels=m_ArgsInfo.levels_arg;
     if (m_Verbose) std::cout<<"Setting the number of resolution levels to "<<nLevels<<"..."<<std::endl;
     multiResolutionFilter->SetFixedImage( fixedImage );
@@ -343,8 +349,14 @@ namespace clitk
     multiResolutionFilter->SetNumberOfLevels( nLevels );
     multiResolutionFilter->SetFixedImagePyramid( fixedImagePyramid );
     multiResolutionFilter->SetMovingImagePyramid( movingImagePyramid );
-    if (threadsGiven) multiResolutionFilter->SetNumberOfThreads( threads );
-    
+    if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+      multiResolutionFilter->SetNumberOfThreads( threads );
+#else
+      multiResolutionFilter->SetNumberOfWorkUnits( threads );
+#endif
+    }
+
     //------------------------------------
     //Set the number of iterations
     //------------------------------------
index 46dcae977f831413a449408d6bc341b1d611d9ce..067cd8757132d7e6fd6c1ca8b421a849d7d8c65f 100644 (file)
@@ -95,7 +95,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  virtual void Initialize(void) ITK_OVERRIDE;
+#else
   virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
index 0f8fa64c5d975dbb3c4083e6699e2dd7bc91bc2d..ea2c52a56222a9db07d45d1026f4e4a728d0b2a6 100644 (file)
@@ -117,7 +117,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+::Initialize(void)
+#else
 ::Initialize(void) throw ( itk::ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
@@ -130,44 +134,74 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   if(m_ThreaderSFF != NULL) {
     delete [] m_ThreaderSFF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFF = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFF = new double[this->m_NumberOfWorkUnits];
+#endif
 
 
   if(m_ThreaderSMM != NULL) {
     delete [] m_ThreaderSMM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSMM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSMM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderSFM != NULL) {
     delete [] m_ThreaderSFM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(this->m_SubtractMean) {
     if(m_ThreaderSF != NULL) {
       delete [] m_ThreaderSF;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSF = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSF = new double[this->m_NumberOfWorkUnits];
+#endif
 
     if(m_ThreaderSM != NULL) {
       delete [] m_ThreaderSM;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSM = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSM = new double[this->m_NumberOfWorkUnits];
+#endif
   }
 
   if(m_ThreaderDerivativeF != NULL) {
     delete [] m_ThreaderDerivativeF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeF[threadID].SetSize( this->m_NumberOfParameters );
   }
 
   if(m_ThreaderDerivativeM != NULL) {
     delete [] m_ThreaderDerivativeM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeM[threadID].SetSize( this->m_NumberOfParameters );
   }
 }
@@ -208,12 +242,23 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 
 
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -244,7 +289,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   sf  = m_ThreaderSF[0];
   sm  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     sff +=  m_ThreaderSFF[t];
     smm +=  m_ThreaderSMM[t];
     sfm +=  m_ThreaderSFM[t];
@@ -282,12 +331,23 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 {
   //No checking for the fixed image,  done in the caller
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -317,7 +377,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   m_SF  = m_ThreaderSF[0];
   m_SM  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     m_SFF +=  m_ThreaderSFF[t];
     m_SMM +=  m_ThreaderSMM[t];
     m_SFM +=  m_ThreaderSFM[t];
@@ -431,8 +495,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   memset( derivative.data_block(),
           0,
           this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
-
+#if ITK_VERSION_MAJOR <= 4
   for( unsigned int threadID = 0; threadID<this->m_NumberOfThreads; threadID++ ) {
+#else
+  for( unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits; threadID++ ) {
+#endif
     memset( m_ThreaderDerivativeF[threadID].data_block(),
             0,
             this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
@@ -447,7 +514,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 
   // Accumulate over the threads
   DerivativeType derivativeF(this->m_NumberOfParameters), derivativeM(this->m_NumberOfParameters);
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=0; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=0; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) {
       derivativeF[parameter] += m_ThreaderDerivativeF[t][parameter];
       derivativeM[parameter] += m_ThreaderDerivativeM[t][parameter];
index 24afdbe2ff027ac6da61eb51d4bdd0e7199223ce..208cb38023df53f097934773c3f5cd0d6bb2926a 100644 (file)
@@ -95,7 +95,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  virtual void Initialize(void) ITK_OVERRIDE;
+#else
   virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
index 959bfed1afd56d50dca9a3ec725c8f2f306873c6..042b4b79863927cbd9d0e4b0e57579a2f7846ec7 100644 (file)
@@ -117,7 +117,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+::Initialize(void)
+#else
 ::Initialize(void) throw ( itk::ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
@@ -130,44 +134,74 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   if(m_ThreaderSFF != NULL) {
     delete [] m_ThreaderSFF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFF = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFF = new double[this->m_NumberOfWorkUnits];
+#endif
 
 
   if(m_ThreaderSMM != NULL) {
     delete [] m_ThreaderSMM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSMM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSMM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderSFM != NULL) {
     delete [] m_ThreaderSFM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(this->m_SubtractMean) {
     if(m_ThreaderSF != NULL) {
       delete [] m_ThreaderSF;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSF = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSF = new double[this->m_NumberOfWorkUnits];
+#endif
 
     if(m_ThreaderSM != NULL) {
       delete [] m_ThreaderSM;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSM = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSM = new double[this->m_NumberOfWorkUnits];
+#endif
   }
 
   if(m_ThreaderDerivativeF != NULL) {
     delete [] m_ThreaderDerivativeF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeF[threadID].SetSize( this->m_NumberOfParameters );
   }
 
   if(m_ThreaderDerivativeM != NULL) {
     delete [] m_ThreaderDerivativeM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeM[threadID].SetSize( this->m_NumberOfParameters );
   }
 }
@@ -208,12 +242,23 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
 
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -244,7 +289,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   sf  = m_ThreaderSF[0];
   sm  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     sff +=  m_ThreaderSFF[t];
     smm +=  m_ThreaderSMM[t];
     sfm +=  m_ThreaderSFM[t];
@@ -282,12 +331,23 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 {
   //No checking for the fixed image,  done in the caller
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -317,7 +377,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   m_SF  = m_ThreaderSF[0];
   m_SM  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     m_SFF +=  m_ThreaderSFF[t];
     m_SMM +=  m_ThreaderSMM[t];
     m_SFM +=  m_ThreaderSFM[t];
@@ -457,7 +521,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
           0,
           this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
 
+#if ITK_VERSION_MAJOR <= 4
   for( unsigned int threadID = 0; threadID<this->m_NumberOfThreads; threadID++ ) {
+#else
+  for( unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits; threadID++ ) {
+#endif
     memset( m_ThreaderDerivativeF[threadID].data_block(),
             0,
             this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
@@ -472,7 +540,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
   // Accumulate over the threads
   DerivativeType derivativeF(this->m_NumberOfParameters), derivativeM(this->m_NumberOfParameters);
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=0; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=0; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) {
       derivativeF[parameter] += m_ThreaderDerivativeF[t][parameter];
       derivativeM[parameter] += m_ThreaderDerivativeM[t][parameter];
index e914c1fec5ed56dc9b8939c5766ee6e6d0bd6b3f..c51414ed6d8b6a9e51232a80a0fcc5955acafa7e 100644 (file)
@@ -187,7 +187,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  virtual void Initialize(void) ITK_OVERRIDE;
+#else
   virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
index dec3acff0b59f079ae9922cd8828cdd057eb0941..ef4257e6c66f0525a8c15806923a0aaead195ae2 100644 (file)
@@ -183,7 +183,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+::Initialize(void)
+#else
 ::Initialize(void) throw ( ExceptionObject )
+#endif
 {
   this->Superclass::Initialize();
   this->Superclass::MultiThreadingInitialize();
@@ -192,7 +196,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   typename FixedImageStatisticsFilterType::Pointer fixedImageStats =
     FixedImageStatisticsFilterType::New();
   fixedImageStats->SetInput( this->m_FixedImage );
+#if ITK_VERSION_MAJOR <= 4
   fixedImageStats->SetNumberOfThreads( this->m_NumberOfThreads );
+#else
+  fixedImageStats->SetNumberOfWorkUnits( this->m_NumberOfWorkUnits );
+#endif
   fixedImageStats->Update();
 
   m_FixedImageTrueMin = fixedImageStats->GetMinimum();
@@ -205,7 +213,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   typename MovingImageStatisticsFilterType::Pointer movingImageStats =
     MovingImageStatisticsFilterType::New();
   movingImageStats->SetInput( this->m_MovingImage );
+#if ITK_VERSION_MAJOR <= 4
   movingImageStats->SetNumberOfThreads( this->m_NumberOfThreads );
+#else
+  movingImageStats->SetNumberOfWorkUnits( this->m_NumberOfWorkUnits );
+#endif
   movingImageStats->Update();
 
   m_MovingImageTrueMin = movingImageStats->GetMinimum();
@@ -362,35 +374,62 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   }
   // Assumes number of threads doesn't change between calls to Initialize
   m_ThreaderFixedImageMarginalPDF = new
-  PDFValueType[(this->m_NumberOfThreads-1)
-               * m_NumberOfHistogramBins];
+#if ITK_VERSION_MAJOR <= 4
+  PDFValueType[(this->m_NumberOfThreads-1) * m_NumberOfHistogramBins];
+#else
+  PDFValueType[(this->m_NumberOfWorkUnits-1) * m_NumberOfHistogramBins];
+#endif
 
   if(m_ThreaderJointPDF != NULL) {
     delete [] m_ThreaderJointPDF;
   }
   m_ThreaderJointPDF = new typename
+#if ITK_VERSION_MAJOR <= 4
   JointPDFType::Pointer[this->m_NumberOfThreads-1];
+#else
+  JointPDFType::Pointer[this->m_NumberOfWorkUnits-1];
+#endif
 
   if(m_ThreaderJointPDFStartBin != NULL) {
     delete [] m_ThreaderJointPDFStartBin;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderJointPDFStartBin = new int[this->m_NumberOfThreads];
+#else
+  m_ThreaderJointPDFStartBin = new int[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderJointPDFEndBin != NULL) {
     delete [] m_ThreaderJointPDFEndBin;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderJointPDFEndBin = new int[this->m_NumberOfThreads];
+#else
+  m_ThreaderJointPDFEndBin = new int[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderJointPDFSum != NULL) {
     delete [] m_ThreaderJointPDFSum;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderJointPDFSum = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderJointPDFSum = new double[this->m_NumberOfWorkUnits];
+#endif
 
   unsigned int threadID;
 
+#if ITK_VERSION_MAJOR <= 4
   int binRange = m_NumberOfHistogramBins / this->m_NumberOfThreads;
+#else
+  int binRange = m_NumberOfHistogramBins / this->m_NumberOfWorkUnits;
+#endif
 
+#if ITK_VERSION_MAJOR <= 4
   for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) {
+#else
+  for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
     m_ThreaderJointPDF[threadID] = JointPDFType::New();
     m_ThreaderJointPDF[threadID]->SetRegions( jointPDFRegion );
     m_ThreaderJointPDF[threadID]->Allocate();
@@ -399,10 +438,13 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     m_ThreaderJointPDFEndBin[threadID] = (threadID + 1) * binRange - 1;
   }
 
-  m_ThreaderJointPDFStartBin[this->m_NumberOfThreads-1] =
-    (this->m_NumberOfThreads - 1 ) * binRange;
-
+#if ITK_VERSION_MAJOR <= 4
+  m_ThreaderJointPDFStartBin[this->m_NumberOfThreads-1] = (this->m_NumberOfThreads - 1 ) * binRange;
   m_ThreaderJointPDFEndBin[this->m_NumberOfThreads-1] = m_NumberOfHistogramBins - 1;
+#else
+  m_ThreaderJointPDFStartBin[this->m_NumberOfWorkUnits-1] = (this->m_NumberOfWorkUnits - 1 ) * binRange;
+  m_ThreaderJointPDFEndBin[this->m_NumberOfWorkUnits-1] = m_NumberOfHistogramBins - 1;
+#endif
 
   // Release memory of arrays that may have been used for
   // previous executions of this metric with different settings
@@ -420,18 +462,34 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
   if( this->m_UseExplicitPDFDerivatives ) {
     m_ThreaderJointPDFDerivatives = new typename
+#if ITK_VERSION_MAJOR <= 4
     JointPDFDerivativesType::Pointer[this->m_NumberOfThreads-1];
+#else
+    JointPDFDerivativesType::Pointer[this->m_NumberOfWorkUnits-1];
+#endif
 
+#if ITK_VERSION_MAJOR <= 4
     for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) {
+#else
+    for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
       m_ThreaderJointPDFDerivatives[threadID] = JointPDFDerivativesType::New();
       m_ThreaderJointPDFDerivatives[threadID]->SetRegions(
         jointPDFDerivativesRegion );
       m_ThreaderJointPDFDerivatives[threadID]->Allocate();
     }
   } else {
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderMetricDerivative = new DerivativeType[this->m_NumberOfThreads-1];
+#else
+    m_ThreaderMetricDerivative = new DerivativeType[this->m_NumberOfWorkUnits-1];
+#endif
 
+#if ITK_VERSION_MAJOR <= 4
     for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) {
+#else
+    for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
       this->m_ThreaderMetricDerivative[threadID] = DerivativeType( this->GetNumberOfParameters() );
     }
   }
@@ -595,7 +653,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   unsigned int       tPdfPtrOffset;
   tPdfPtrOffset = ( m_ThreaderJointPDFStartBin[threadID]
                     * m_JointPDF->GetOffsetTable()[1] );
+#if ITK_VERSION_MAJOR <= 4
   for(t=0; t<this->m_NumberOfThreads-1; t++) {
+#else
+  for(t=0; t<this->m_NumberOfWorkUnits-1; t++) {
+#endif
     pdfPtr = pdfPtrStart;
     tPdfPtr = m_ThreaderJointPDF[t]->GetBufferPointer() + tPdfPtrOffset;
     tPdfPtrEnd = tPdfPtr + maxI;
@@ -637,7 +699,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   // MUST BE CALLED TO INITIATE PROCESSING
   this->GetValueMultiThreadedPostProcessInitiate();
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int threadID = 0; threadID<this->m_NumberOfThreads-1; threadID++) {
+#else
+  for(unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
     m_JointPDFSum += m_ThreaderJointPDFSum[threadID];
   }
   if ( m_JointPDFSum == 0.0 ) {
@@ -883,7 +949,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     JointPDFDerivativesValueType *tPdfDPtrEnd;
     unsigned int tPdfDPtrOffset;
     tPdfDPtrOffset = m_ThreaderJointPDFStartBin[threadID] *  rowSize;
+#if ITK_VERSION_MAJOR <= 4
     for(unsigned int t=0; t<this->m_NumberOfThreads-1; t++) {
+#else
+    for(unsigned int t=0; t<this->m_NumberOfWorkUnits-1; t++) {
+#endif
       pdfDPtr = pdfDPtrStart;
       tPdfDPtr = m_ThreaderJointPDFDerivatives[t]->GetBufferPointer()
                  + tPdfDPtrOffset;
@@ -930,7 +1000,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   } else {
     this->m_PRatioArray.Fill( 0.0 );
     this->m_MetricDerivative.Fill( NumericTraits< MeasureType >::Zero );
+#if ITK_VERSION_MAJOR <= 4
     for(unsigned int threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++ ) {
+#else
+    for(unsigned int threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++ ) {
+#endif
       this->m_ThreaderMetricDerivative[threadID].Fill( NumericTraits< MeasureType >::Zero );
     }
     this->m_ImplicitDerivativesSecondPass = false;
@@ -945,7 +1019,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   // CALL IF DOING THREADED POST PROCESSING
   this->GetValueAndDerivativeMultiThreadedPostProcessInitiate();
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int threadID = 0; threadID<this->m_NumberOfThreads-1; threadID++) {
+#else
+  for(unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
     m_JointPDFSum += m_ThreaderJointPDFSum[threadID];
   }
   if ( m_JointPDFSum == 0.0 ) {
@@ -1054,7 +1132,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
     // Consolidate the contributions from each one of the threads to the total
     // derivative.
+#if ITK_VERSION_MAJOR <= 4
     for(unsigned int t = 0; t < this->m_NumberOfThreads-1; t++ ) {
+#else
+    for(unsigned int t = 0; t < this->m_NumberOfWorkUnits-1; t++ ) {
+#endif
       DerivativeType * source = &(this->m_ThreaderMetricDerivative[t]);
       for(unsigned int pp=0; pp < this->m_NumberOfParameters; pp++ ) {
         this->m_MetricDerivative[pp] += (*source)[pp];
index 06ecf29344a77e584ce6e7229bc7ade6df629b27..e12b42fb52684d325493940bbfd08f644f0e49ae 100644 (file)
@@ -98,7 +98,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+  virtual void Initialize(void) ITK_OVERRIDE;
+#else
   virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
index dd7000ddec171559063f684d1218d9014cdeddd4..02427a397d50e586ef70dc381ffff5541c6114fb 100644 (file)
@@ -100,7 +100,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+::Initialize(void)
+#else
 ::Initialize(void) throw ( ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
@@ -109,13 +113,22 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   if(m_ThreaderMSE != NULL) {
     delete [] m_ThreaderMSE;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderMSE = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderMSE = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderMSEDerivatives != NULL) {
     delete [] m_ThreaderMSEDerivatives;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderMSEDerivatives = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderMSEDerivatives = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderMSEDerivatives[threadID].SetSize( this->m_NumberOfParameters );
   }
 }
@@ -147,9 +160,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     itkExceptionMacro( << "Fixed image has not been assigned" );
   }
 
-  memset( m_ThreaderMSE,
-          0,
-          this->m_NumberOfThreads * sizeof(MeasureType) );
+#if ITK_VERSION_MAJOR <= 4
+  memset( m_ThreaderMSE, 0, this->m_NumberOfThreads * sizeof(MeasureType) );
+#else
+  memset( m_ThreaderMSE, 0, this->m_NumberOfWorkUnits * sizeof(MeasureType) );
+#endif
 
   // Set up the parameters in the transform
   this->m_Transform->SetParameters( parameters );
@@ -171,7 +186,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   }
 
   double mse = m_ThreaderMSE[0];
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     mse += m_ThreaderMSE[t];
   }
   mse /= this->m_NumberOfPixelsCounted;
@@ -252,9 +271,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   this->m_Transform->SetParameters( parameters );
 
   // Reset the joint pdfs to zero
-  memset( m_ThreaderMSE,
-          0,
-          this->m_NumberOfThreads * sizeof(MeasureType) );
+#if ITK_VERSION_MAJOR <= 4
+  memset( m_ThreaderMSE, 0, this->m_NumberOfThreads * sizeof(MeasureType) );
+#else
+  memset( m_ThreaderMSE, 0, this->m_NumberOfWorkUnits * sizeof(MeasureType) );
+#endif
 
   // Set output values to zero
   if(derivative.GetSize() != this->m_NumberOfParameters) {
@@ -264,7 +285,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
           0,
           this->m_NumberOfParameters * sizeof(double) );
 
+#if ITK_VERSION_MAJOR <= 4
   for( unsigned int threadID = 0; threadID<this->m_NumberOfThreads; threadID++ ) {
+#else
+  for( unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits; threadID++ ) {
+#endif
     memset( m_ThreaderMSEDerivatives[threadID].data_block(),
             0,
             this->m_NumberOfParameters * sizeof(double) );
@@ -287,7 +312,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   }
 
   value = 0;
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=0; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=0; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     value += m_ThreaderMSE[t];
     for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters;
         parameter++) {
index e616c358fa6b156fbf976032f894afb3e58db9b1..0a044fed096838487b6043b9e4083bcb771068f7 100644 (file)
@@ -54,6 +54,11 @@ if(CLITK_BUILD_TOOLS)
   target_link_libraries(clitkImageInfo clitkCommon)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageInfo)
 
+  WRAP_GGO(clitkScintivolStats_GGO_C clitkScintivolStats.ggo)
+  add_executable(clitkScintivolStats clitkScintivolStats.cxx ${clitkScintivolStats_GGO_C})
+  target_link_libraries(clitkScintivolStats clitkCommon)
+  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkScintivolStats)
+
   add_executable(clitkImageConvert clitkImageConvert.cxx)
   target_link_libraries(clitkImageConvert clitkImageConvertLib clitkCommon)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageConvert)
@@ -147,13 +152,14 @@ if(CLITK_BUILD_TOOLS)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkInvertVF)
 
   WRAP_GGO(clitkAffineTransform_GGO_C clitkAffineTransform.ggo)
+  add_library(clitkAffineTransformLib clitkAffineTransform.cxx ${clitkAffineTransform_GGO_C})
   add_executable(clitkAffineTransform clitkAffineTransform.cxx ${clitkAffineTransform_GGO_C})
   target_link_libraries(clitkAffineTransform clitkCommon )
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkAffineTransform)
 
   WRAP_GGO(clitkElastixTransformToMatrix_GGO_C clitkElastixTransformToMatrix.ggo)
   add_executable(clitkElastixTransformToMatrix clitkElastixTransformToMatrix.cxx ${clitkElastixTransformToMatrix_GGO_C})
-  target_link_libraries(clitkElastixTransformToMatrix clitkCommon )
+  target_link_libraries(clitkElastixTransformToMatrix clitkAffineTransformLib clitkCommon )
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkElastixTransformToMatrix)
 
   WRAP_GGO(clitkMatrixToElastixTransform_GGO_C clitkMatrixToElastixTransform.ggo)
@@ -269,6 +275,16 @@ if(CLITK_BUILD_TOOLS)
   target_link_libraries(clitkImageStatistics clitkCommon)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageStatistics)
 
+  WRAP_GGO(clitkSUVPeak_GGO_C clitkSUVPeak.ggo)
+  add_executable(clitkSUVPeak clitkSUVPeak.cxx clitkSUVPeakGenericFilter.cxx ${clitkSUVPeak_GGO_C})
+  target_link_libraries(clitkSUVPeak clitkCommon)
+  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSUVPeak)
+
+  WRAP_GGO(clitkRTStructStatistics_GGO_C clitkRTStructStatistics.ggo)
+  add_executable(clitkRTStructStatistics clitkRTStructStatistics.cxx clitkRTStructStatisticsGenericFilter.cxx ${clitkRTStructStatistics_GGO_C})
+  target_link_libraries(clitkRTStructStatistics clitkCommon)
+  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkRTStructStatistics)
+
   WRAP_GGO(clitkVFConvert_GGO_C clitkVFConvert.ggo)
   add_executable(clitkVFConvert clitkVFConvert.cxx clitkVFConvertGenericFilter.cxx ${clitkVFConvert_GGO_C})
   target_link_libraries(clitkVFConvert clitkCommon )
@@ -303,6 +319,11 @@ if(CLITK_BUILD_TOOLS)
   target_link_libraries(clitkSum clitkCommon)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSum)
 
+  WRAP_GGO(clitkExtrude_GGO_C clitkExtrude.ggo)
+  add_executable(clitkExtrude clitkExtrude.cxx ${clitkExtrude_GGO_C})
+  target_link_libraries(clitkExtrude clitkCommon)
+  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkExtrude)
+
   WRAP_GGO(clitkTransformLandmarks_GGO_C clitkTransformLandmarks.ggo)
   add_executable(clitkTransformLandmarks clitkTransformLandmarks.cxx ${clitkTransformLandmarks_GGO_C})
   target_link_libraries(clitkTransformLandmarks clitkCommon)
index ab488f3710edcddb8952f142a53d051acf157827..a3ec42038e431c41c909550e5ed6b4c6f2eaf70f 100644 (file)
@@ -94,6 +94,10 @@ namespace clitk
       //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
       //       UpdateWithDimAndPixelType<Dimension, signed char>();
       //     }
+      else if(PixelType == "double"){
+        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and double..." << std::endl;
+        UpdateWithDimAndPixelType<Dimension, double>();
+      }
       else {
         if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
         UpdateWithDimAndPixelType<Dimension, float>();
index 52dd428c778749ae7930a6d8abe70adf0810a559..d5a552d3e582cd56a1ab8f3276adb069ee406acc 100644 (file)
@@ -34,7 +34,7 @@ namespace clitk
   //================================================================================
   template <class  InputPixelType> void BackProjectImageGenericFilter::UpdateWithPixelType()
   {
-   
+
     //---------------------------------
     // Define the images
     //---------------------------------
@@ -51,81 +51,87 @@ namespace clitk
     const unsigned int OutputImageDimension=3;    
     typedef float OutputPixelType;    
     typedef itk::Image<OutputPixelType, OutputImageDimension> OutputImageType;
-   
+
     //Create the BackProjectImageFilter
     typedef BackProjectImageFilter<InputImageType, OutputImageType> BackProjectImageFilterType;
     typename BackProjectImageFilterType::Pointer filter=BackProjectImageFilterType::New();
-   
+
 
     //---------------------------------
     //Pass all the necessary parameters
     //---------------------------------
     unsigned int i=0;
     filter->SetInput(input);
-    if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
-   
+    if (m_ArgsInfo.threads_given) {
+#if ITK_VERSION_MAJOR <= 4
+      filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+#else
+      filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg);
+#endif
+    }
+
     //Projection parameters
     OutputImageType::PointType iso;
     if (m_ArgsInfo.iso_given)
-      {
-       for(i=0;i<OutputImageDimension;i++)
-         iso[i]=m_ArgsInfo.iso_arg[i];
-       filter->SetIsoCenter(iso);
-      }
+    {
+      for(i=0;i<OutputImageDimension;i++)
+        iso[i]=m_ArgsInfo.iso_arg[i];
+      filter->SetIsoCenter(iso);
+    }
     if (m_ArgsInfo.panel_shift_given)
       filter->SetPanelShift(m_ArgsInfo.panel_shift_arg[0], m_ArgsInfo.panel_shift_arg[1]);
     filter->SetSourceToScreen(m_ArgsInfo.screen_arg);
     filter->SetSourceToAxis(m_ArgsInfo.axis_arg); 
     filter->SetProjectionAngle(m_ArgsInfo.angle_arg);
     if (m_ArgsInfo.matrix_given)
-      {
-       itk::Matrix<double,4,4> rt =ReadMatrix3D(m_ArgsInfo.matrix_arg);
-        filter->SetRigidTransformMatrix(rt);
-      }
+    {
+      itk::Matrix<double,4,4> rt =ReadMatrix3D(m_ArgsInfo.matrix_arg);
+            filter->SetRigidTransformMatrix(rt);
+    }
     filter->SetEdgePaddingValue(static_cast<OutputPixelType>(m_ArgsInfo.pad_arg));
-    
+
     //Output image info
     if (m_ArgsInfo.like_given)
-      {
-       typedef itk::ImageFileReader<OutputImageType> ReaderType;
-       ReaderType::Pointer reader2=ReaderType::New();
-       reader2->SetFileName(m_ArgsInfo.like_arg);
-       reader2->Update();
+    {
+      typedef itk::ImageFileReader<OutputImageType> ReaderType;
+      ReaderType::Pointer reader2=ReaderType::New();
+      reader2->SetFileName(m_ArgsInfo.like_arg);
+      reader2->Update();
 
-       OutputImageType::Pointer image=reader2->GetOutput();
-       filter->SetOutputParametersFromImage(image);
-      }
+      OutputImageType::Pointer image=reader2->GetOutput();
+      filter->SetOutputParametersFromImage(image);
+    }
     else
+    {
+      if(m_ArgsInfo.origin_given)
       {
-       if(m_ArgsInfo.origin_given)
-         {
-           OutputImageType::PointType origin;
-           for(i=0;i<OutputImageDimension;i++)
-             origin[i]=m_ArgsInfo.origin_arg[i];
-           filter->SetOutputOrigin(origin);
-         }
-       if (m_ArgsInfo.spacing_given)
-         {
-           OutputImageType::SpacingType spacing;
-           for(i=0;i<OutputImageDimension;i++)
-             spacing[i]=m_ArgsInfo.spacing_arg[i];
-           filter->SetOutputSpacing(spacing);
-         }
-       if (m_ArgsInfo.spacing_given)
-         {
-           OutputImageType::SizeType size;
-           for(i=0;i<OutputImageDimension;i++)
-             size[i]=m_ArgsInfo.size_arg[i];
-           filter->SetOutputSize(size);
-         }
+        OutputImageType::PointType origin;
+        for(i=0;i<OutputImageDimension;i++)
+          origin[i]=m_ArgsInfo.origin_arg[i];
+        filter->SetOutputOrigin(origin);
       }
+      if (m_ArgsInfo.spacing_given)
+      {
+        OutputImageType::SpacingType spacing;
+        for(i=0;i<OutputImageDimension;i++)
+          spacing[i]=m_ArgsInfo.spacing_arg[i];
+        filter->SetOutputSpacing(spacing);
+      }
+      if (m_ArgsInfo.spacing_given)
+      {
+        OutputImageType::SizeType size;
+        for(i=0;i<OutputImageDimension;i++)
+          size[i]=m_ArgsInfo.size_arg[i];
+        filter->SetOutputSize(size);
+      }
+    }
 
     //Go
     filter->Update();
-    
+
     //Get the output
     OutputImageType::Pointer output=filter->GetOutput();
+
     //Write the output
     typedef itk::ImageFileWriter<OutputImageType> OutputWriterType;
     OutputWriterType::Pointer outputWriter = OutputWriterType::New();
index a674f8bbef5b5450493a3c0eae14ccde4acb0579..6308dd212492783e186d48bfc5d3943f4dd21a83 100644 (file)
@@ -1,32 +1,30 @@
 #File clitkCropImage.ggo
 package "clitkCropImage"
 version "1.0"
-purpose "Crop an image according to a given extends or AutoCrop with a background value or like another image"
+purpose "Crop an image according to a given extends or AutoCrop with a background value or like another image.
+In all cases, by default, the output origin is set to be able to overlay input and output without registration."
 
-option "config"                   -  "Config file"                 string  no
-option "imagetypes"        -  "Display allowed image types" flag    off
-option "verbose"           v  "Verbose"                            flag    off
-option "verboseOption"     -  "Display options values"      flag    off
-option "verboseWarningOff" -  "Do not display warning"      flag    off
+option "config"             - "Config file"                                                                                                             string  no
+option "imagetypes"         - "Display allowed image types"                                                                                             flag    off
+option "verbose"            v "Verbose"                                                                                                                 flag    off
+option "verboseOption"      - "Display options values"                                                                                                  flag    off
+option "verboseWarningOff"  - "Do not display warning"                                                                                                  flag    off
 
 section "I/O"
 
-option "input"         i       "Input image filename"            string        yes
-option "output"        o       "Output image filename"           string        yes
+option "input"              i "Input image filename"                                                                                                    string  yes
+option "output"             o "Output image filename"                                                                                                   string  yes
 
 section "Used determined crop"
-option "boundingBox"           b       "Bounding box of the crop region (in 3D: =x1,x2,y1,y2,z1,z2)"  int      no  multiple
-option "lower"         l       "Size of the lower crop region (multiple values)"         int   no  multiple
-option "upper"         u       "Size of the upper crop region (multiple values)"         int   no  multiple
-option "origin"        -       "Set new origin to zero"          flag  off  
+option "boundingBox"        b "Bounding box of the crop region in pixel (in 3D: =x1,x2,y1,y2,z1,z2)"                                                    int     no          multiple
+option "lower"              l "Size of the lower crop region (multiple values)"                                                                         int     no          multiple
+option "upper"              u "Size of the upper crop region (multiple values)"                                                                         int     no          multiple
+option "origin"             - "Set new origin to zero"                                                                                                  flag    off
 
 section "AutoCrop with BG value"
-option "BG"            -       "Background value in input."      double default="0" no
+option "BG"                 - "Background value in input."                                                                                              double  default="0" no
 
 section "Crop like another image"
-option "like"          -       "Crop like this image (must have the same spacing"   string no
-option "BGLike"                -       "Background value in output (if like larger)"        double default="0" no
-
-
-
-
+option "like"               - "Crop like this image (must have the same spacing"                                                                        string  no
+option "updateOrigin"       - "By default, with like image, the output origin is the same than the like image. Set to on the flag to keep the origin."  flag    off
+option "BGLike"             - "Background value in output (if like larger)"                                                                             double  default="0" no
index 4adcb9bfadbae4ea0f1b5bc7fa6b9a385990f42e..4f3bb231762ca6c6fe19fdc528a90a8c15b5456d 100644 (file)
@@ -106,6 +106,8 @@ void clitk::CropImageGenericFilter::UpdateWithInputImageType()
   // Check options
   if (mArgsInfo.BG_given && mArgsInfo.like_given)
     clitkExceptionMacro("Do not use --BG and --like at the same time");
+  if (mArgsInfo.updateOrigin_flag && !mArgsInfo.like_given)
+    clitkExceptionMacro("Use --updateOrigin with --like");
 
   // Prepare output
   typename ImageType::Pointer output;
@@ -182,7 +184,7 @@ void clitk::CropImageGenericFilter::UpdateWithInputImageType()
   typename ImageType::IndexType index = region.GetIndex();
   typename ImageType::PointType origin = output->GetOrigin();
   typename ImageType::SpacingType spacing = output->GetSpacing();
-  if (!mArgsInfo.BG_given) {
+  if (!mArgsInfo.BG_given && (!mArgsInfo.like_given || mArgsInfo.updateOrigin_flag)) {
     if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl;
     input->TransformIndexToPhysicalPoint(index,origin);
     if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl;
index 51a32d15550ff3a1afe2dff199d97514e81ccbd0..aa63b0489bd50505255c2610640e8bbb4615c70e 100644 (file)
@@ -26,7 +26,7 @@
 #include <gdcmFile.h>
 #include <vtkVersion.h>
 #include <vtkImageChangeInformation.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   #include <gdcmImageHelper.h>
   #include <gdcmAttribute.h>
   #include <gdcmReader.h>
@@ -64,7 +64,7 @@ int main(int argc, char * argv[])
   std::map< int, std::vector<double> > theorientation;
   std::map< int, std::vector<double> > sliceLocations;
   std::map< int, std::vector<std::string> > seriesFiles;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   if (args_info.verbose_flag)
     std::cout << "Using GDCM-2.x" << std::endl;
 #else
@@ -76,7 +76,7 @@ int main(int argc, char * argv[])
   for(unsigned int i=0; i<args_info.inputs_num; i++) {
     if (args_info.verbose_flag)
         std::cout << "Reading <" << input_files[i] << std::endl;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     gdcm::Reader hreader;
     hreader.SetFileName(input_files[i].c_str());
     hreader.Read();
@@ -91,7 +91,7 @@ int main(int argc, char * argv[])
     series_numbers.insert(series_number);
     theorigin[series_number] = gdcm::ImageHelper::GetOriginValue(hreader.GetFile());
     theorientation[series_number] = gdcm::ImageHelper::GetDirectionCosinesValue(hreader.GetFile());
-    if (args_info.extract_series_flag) {
+    if (args_info.patientSystem_flag) {
       double n1 = theorientation[series_number][1]*theorientation[series_number][5]-
                   theorientation[series_number][2]*theorientation[series_number][4];
       double n2 = theorientation[series_number][3]*theorientation[series_number][2]-
@@ -241,7 +241,7 @@ int main(int argc, char * argv[])
     }
     vvImageWriter::Pointer writer = vvImageWriter::New();
     writer->SetInput(image);
-    if (args_info.extract_series_flag && !image->GetTransform().empty())
+    if (args_info.patientSystem_flag && !image->GetTransform().empty())
       writer->SetSaveTransform(true);
     writer->SetOutputFileName(outfile);
     writer->Update();
index 202afc762feab842659b4421915b6faf74a4e275..183f09febbe63ca7eea4819590c11b57e531ad3f 100644 (file)
@@ -28,7 +28,7 @@
 
 // itk (gdcm) include
 #include "gdcmFile.h"
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include "gdcmReader.h"
 #include "gdcmPrinter.h"
 #include "gdcmDict.h"
@@ -46,7 +46,7 @@ int main(int argc, char * argv[])
   if (args_info.inputs_num == 0) return 0;
 
   // Study ID
- #if GDCM_MAJOR_VERSION == 2
+ #if GDCM_MAJOR_VERSION >= 2
  if (args_info.studyID_flag) {
     std::set<std::string> l;
     for(unsigned int i=0; i<args_info.inputs_num; i++) {
@@ -85,7 +85,7 @@ int main(int argc, char * argv[])
  if (!args_info.studyID_flag)
   for(unsigned int i=0; i<args_info.inputs_num; i++) {
     if (args_info.filename_flag) std::cout << args_info.inputs[i] << std::endl;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     gdcm::Reader reader;
     reader.SetFileName(args_info.inputs[i]);
     reader.Read();
diff --git a/tools/clitkExtrude.cxx b/tools/clitkExtrude.cxx
new file mode 100644 (file)
index 0000000..f860f58
--- /dev/null
@@ -0,0 +1,45 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+// clitk
+#include "clitkExtrude_ggo.h"
+#include "clitkExtrudeGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkExtrude, args_info);
+  CLITK_INIT;
+
+  // Filter
+  typedef clitk::ExtrudeGenericFilter<args_info_clitkExtrude> FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  filter->SetArgsInfo(args_info);
+  try {
+    filter->Update();
+  } catch(std::runtime_error e) {
+    std::cout << e.what() << std::endl;
+  }
+
+  return EXIT_SUCCESS;
+}// end main
+
+//--------------------------------------------------------------------
diff --git a/tools/clitkExtrude.ggo b/tools/clitkExtrude.ggo
new file mode 100644 (file)
index 0000000..8dae45d
--- /dev/null
@@ -0,0 +1,14 @@
+#File clitkExtrude.ggo
+package "clitkExtrude"
+version "1.0"
+purpose "Extrude an image i along the last+1 dimension repeating the image N times. So the output has 1 dimension more than the input."
+
+option "config"   - "Config file"                               string  optional
+option "verbose"  v "Verbose"                                   flag    off
+
+option "input"    i "Input image filename"                      string  required
+option "output"   o "Output image filename"                     string  required
+option "size"     N "Size in pixel of extrusion"                int     no        default="1"
+option "spacing"  s "Spacing of the new dimension"              double  no        default="1.0"
+option "origin"   - "Origin of the new dimension"               double  no        default="0.0"
+option "like"     l "Size, spacing and origin like this image"  string  no
diff --git a/tools/clitkExtrudeGenericFilter.h b/tools/clitkExtrudeGenericFilter.h
new file mode 100644 (file)
index 0000000..73f512f
--- /dev/null
@@ -0,0 +1,69 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef clitkExtrudeGenericFilter_h
+#define clitkExtrudeGenericFilter_h
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+template<class args_info_type>
+class ITK_EXPORT ExtrudeGenericFilter:
+        public ImageToImageGenericFilter<ExtrudeGenericFilter<args_info_type> >
+{
+
+public:
+
+    //--------------------------------------------------------------------
+    ExtrudeGenericFilter();
+
+    //--------------------------------------------------------------------
+    typedef ExtrudeGenericFilter               Self;
+    typedef itk::SmartPointer<Self>            Pointer;
+    typedef itk::SmartPointer<const Self>      ConstPointer;
+
+    //--------------------------------------------------------------------
+    // Method for creation through the object factory
+    // and Run-time type information (and related methods)
+    itkNewMacro(Self);
+    itkTypeMacro(ExtrudeGenericFilter, LightObject);
+
+    //--------------------------------------------------------------------
+    void SetArgsInfo(const args_info_type & a);
+
+    //--------------------------------------------------------------------
+    // Main function called each time the filter is updated
+    template<class InputImageType>
+    void UpdateWithInputImageType();
+
+protected:
+    template<unsigned int Dim> void InitializeImageType();
+    args_info_type mArgsInfo;
+
+}; // end class
+//--------------------------------------------------------------------
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkExtrudeGenericFilter.txx"
+#endif
+
+#endif // #define clitkExtrudeGenericFilter_h
diff --git a/tools/clitkExtrudeGenericFilter.txx b/tools/clitkExtrudeGenericFilter.txx
new file mode 100644 (file)
index 0000000..30eafea
--- /dev/null
@@ -0,0 +1,190 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef clitkExtrudeGenericFilter_txx
+#define clitkExtrudeGenericFilter_txx
+
+// itk include
+#include <itkImageFileReader.h>
+#include <clitkCommon.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+ExtrudeGenericFilter<args_info_type>::ExtrudeGenericFilter():
+  ImageToImageGenericFilter<Self>("Extrude")
+{
+  InitializeImageType<2>();
+  InitializeImageType<3>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void ExtrudeGenericFilter<args_info_type>::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void ExtrudeGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
+{
+  mArgsInfo=a;
+  this->SetIOVerbose(mArgsInfo.verbose_flag);
+
+  if (mArgsInfo.input_given) {
+    this->SetInputFilename(mArgsInfo.input_arg);
+  }
+  if (mArgsInfo.output_given) {
+    this->SetOutputFilename(mArgsInfo.output_arg);
+  }
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class InputImageType>
+void
+ExtrudeGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+
+  // Reading input
+  typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+
+  // Main filter
+  typedef typename InputImageType::PixelType PixelType;
+  const int Dim = InputImageType::ImageDimension;
+  typedef itk::Image<PixelType,Dim> ImageType;
+  typedef itk::Image<PixelType,Dim+1> OutputImageType;
+
+  //Create the output
+  typename OutputImageType::IndexType start;
+  typename OutputImageType::SizeType size;
+  typename OutputImageType::PointType origin;
+  typename OutputImageType::SpacingType spacing;
+  typename OutputImageType::DirectionType direction;
+  typename OutputImageType::Pointer output = OutputImageType::New();
+
+  start.Fill(0);
+
+  //Check if like is given and not size, origin and spacing
+  int extrusionSize(1);
+  double extrusionOrigin(0.0), extrusionSpacing(1.0);
+
+  if (mArgsInfo.like_given) {
+    if (mArgsInfo.size_given || mArgsInfo.spacing_given || mArgsInfo.origin_given) {
+      std::cerr << "You cannot set --like and --size, --origin or --spacing at the same time" << std::endl;
+      return;
+    }
+
+    // Read the input like image
+    typedef itk::ImageFileReader<OutputImageType> LikeReaderType;
+    typename LikeReaderType::Pointer reader = LikeReaderType::New();
+    reader->SetFileName(mArgsInfo.like_arg);
+    reader->Update();
+    typename OutputImageType::Pointer likeImage = reader->GetOutput();
+
+    extrusionSize = likeImage->GetLargestPossibleRegion().GetSize()[Dim];
+    extrusionSpacing = likeImage->GetSpacing()[Dim];
+    extrusionOrigin = likeImage->GetOrigin()[Dim];
+  } else {
+    if (mArgsInfo.size_given) {
+      if (mArgsInfo.size_arg > 0)
+        extrusionSize = mArgsInfo.size_arg;
+      else {
+        std::cerr << "The size has to be > 0" << std::endl;
+        return;
+      }
+    }
+    if (mArgsInfo.origin_given) {
+      extrusionOrigin = mArgsInfo.origin_arg;
+    }
+    if (mArgsInfo.spacing_given) {
+      if (mArgsInfo.spacing_arg > 0)
+        extrusionSpacing = mArgsInfo.spacing_arg;
+      else {
+        std::cerr << "The spacing has to be > 0" << std::endl;
+        return;
+      }
+    }
+  }
+
+  for (unsigned int i=0; i<Dim; ++i)
+    size[i] = input->GetLargestPossibleRegion().GetSize()[i];
+  size[Dim] = extrusionSize;
+
+  for (unsigned int i=0; i<Dim; ++i)
+    origin[i] = input->GetOrigin()[i];
+  if (mArgsInfo.origin_given)
+    origin[Dim] = mArgsInfo.origin_arg;
+  else
+    origin[Dim] = 0;
+
+  for (unsigned int i=0; i<Dim; ++i)
+    spacing[i] = input->GetSpacing()[i];
+  if (mArgsInfo.spacing_given)
+    spacing[Dim] = mArgsInfo.spacing_arg;
+  else
+    spacing[Dim] = 1;
+
+  for (unsigned int i=0; i<Dim; ++i) {
+    for (unsigned int j=0; j<Dim; ++j)
+      direction[i][j] = input->GetDirection()[i][j];
+    direction[i][Dim] = 0;
+  }
+  for (unsigned int i=0; i<Dim; ++i)
+    direction[Dim][i] = 0;
+  direction[Dim][Dim] = 1;
+
+  typename OutputImageType::RegionType region(start, size);
+  output->SetRegions(region);
+  output->Allocate();
+  output->FillBuffer(0);
+  output->SetOrigin(origin);
+  output->SetSpacing(spacing);
+  output->SetDirection(direction);
+
+  itk::ImageRegionIteratorWithIndex<InputImageType> inputIterator(input, input->GetLargestPossibleRegion());
+  while(!inputIterator.IsAtEnd()) {
+    typename OutputImageType::IndexType pixelIndex;
+    for (unsigned int i=0; i<Dim; ++i)
+      pixelIndex[i] = inputIterator.GetIndex()[i];
+    for (unsigned int i=0; i<extrusionSize; ++i) {
+      pixelIndex[Dim] = i;
+      output->SetPixel(pixelIndex, inputIterator.Get());
+    }
+    ++inputIterator;
+  }
+
+  this->template SetNextOutput<OutputImageType>(output);
+
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif //#define clitkExtrudeGenericFilter_txx
index fe849b38ad9253f9532738304445c1a21ed77ef2..9ad2857f90bd8bb263463b47b932f33cabaaed93 100644 (file)
@@ -134,7 +134,7 @@ void
 GateSimulation2DicomGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 {
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // ImageTypes
   typedef itk::Image<PixelType, Dimension> InputImageType;
   typedef itk::Image<PixelType, Dimension> OutputImageType;
index 1c4e88f3d4e1bd36cd932aeeeb3e9315964d00c6..df105fadfd1a75e1838d057dbd39ee6b9fdb0edb 100644 (file)
@@ -138,7 +138,7 @@ void
 Image2DicomDoseGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 {
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // ImageTypes
   typedef itk::Image<PixelType, Dimension> InputImageType;
   typedef unsigned short int OutputPixelType;
index a18a6417c6b0ad26c3efc14225fba5d1c7444153..405540c41f4494b3e4c3c0749dbaab07f6f5673e 100644 (file)
@@ -156,7 +156,13 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
       filter->SetInput(input);
 
     filter->SetVerbose(m_Verbose);
-    if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+    if (m_ArgsInfo.threads_given) {
+#if ITK_VERSION_MAJOR <= 4
+      filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+#else
+      filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg);
+#endif
+    }
     if (m_ArgsInfo.pad_given) {
       PixelType pad;
       if (m_ArgsInfo.pad_given !=  (pad.GetNumberOfComponents()) )
@@ -187,7 +193,13 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     }
 
     filter->SetVerbose(m_Verbose);
-    if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+    if (m_ArgsInfo.threads_given) {
+#if ITK_VERSION_MAJOR <= 4
+      filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+#else
+      filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg);
+#endif
+    }
     if (m_ArgsInfo.pad_given) {
       PixelType pad;
       if (m_ArgsInfo.pad_given !=  (pad.GetNumberOfComponents()) )
index bf589259cb012c7de5b0ce7102fc8370dbcfd48c..8e8fa33f37f23359d785f9d6531b8e4aab316382 100644 (file)
@@ -136,7 +136,7 @@ void
 PartitionEnergyWindowDicomGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 {
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // ImageTypes
   typedef itk::Image<PixelType, Dimension> InputImageType;
   typedef itk::Image<PixelType, Dimension> OutputImageType;
diff --git a/tools/clitkRTStructStatistics.cxx b/tools/clitkRTStructStatistics.cxx
new file mode 100644 (file)
index 0000000..504c779
--- /dev/null
@@ -0,0 +1,46 @@
+/*=========================================================================SUVP
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKRTSTRUCTSTATISTICS_CXX
+#define CLITKRTSTRUCTSTATISTICS_CXX
+
+// clitk include
+#include "clitkRTStructStatistics_ggo.h"
+#include "clitkRTStructStatisticsGenericFilter.h"
+#include "clitkIO.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkRTStructStatistics, args_info);
+  CLITK_INIT;
+
+  // Creation of a generic filter
+  typedef clitk::RTStructStatisticsGenericFilter<args_info_clitkRTStructStatistics> FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  // Go !
+  filter->SetArgsInfo(args_info);
+  CLITK_TRY_CATCH_EXIT(filter->Update());
+
+  // this is the end my friend
+  return EXIT_SUCCESS;
+} // end main
+
+#endif //define CLITKRTSTRUCTSTATISTICS_CXX
diff --git a/tools/clitkRTStructStatistics.ggo b/tools/clitkRTStructStatistics.ggo
new file mode 100644 (file)
index 0000000..11969b3
--- /dev/null
@@ -0,0 +1,9 @@
+#File clitkRTStructStatistics.ggo
+package "clitkRTStructStatistics"
+version "2.0"
+purpose "Find the centroid (in mm) and roundness of a binarized image."
+
+option "config"   - "Config file"                 string  no
+option "verbose"  v "Verbose"                     flag    off
+
+option "input"    i "Input image filename (mask)" string  yes
diff --git a/tools/clitkRTStructStatisticsGenericFilter.cxx b/tools/clitkRTStructStatisticsGenericFilter.cxx
new file mode 100644 (file)
index 0000000..bff6956
--- /dev/null
@@ -0,0 +1,31 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKRTSTRUCTSTATISTICSGENERICFILTER_CXX
+#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_CXX
+
+#include "clitkRTStructStatisticsGenericFilter.h"
+
+namespace clitk {
+  // Specialisation
+//   template<>
+//   class RTStructStatisticsGenericFilter<args_info_clitkC>;
+
+
+}
+
+#endif //define CLITKRTSTRUCTSTATISTICSGENERICFILTER_CXX
diff --git a/tools/clitkRTStructStatisticsGenericFilter.h b/tools/clitkRTStructStatisticsGenericFilter.h
new file mode 100644 (file)
index 0000000..aeeed80
--- /dev/null
@@ -0,0 +1,84 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKRTSTRUCTSTATISTICSGENERICFILTER_H
+#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_H
+/**
+ -------------------------------------------------------------------
+ * @file   clitkRTStructStatisticsGenericFilter.h
+ * @author Thomas Baudier <thomas.baudier@creatis.insa-lyon.fr>
+ * @date   11 Jul 2016 08:37:53
+
+ * @brief
+ -------------------------------------------------------------------*/
+
+// clitk include
+#include "clitkCommon.h"
+#include "clitkImageToImageGenericFilter.h"
+#include "clitkRTStructStatistics_ggo.h"
+
+// itk include
+#include "itkImage.h"
+#include "itkImageIOBase.h"
+
+//--------------------------------------------------------------------
+namespace clitk {
+
+  template<class args_info_type>
+  class ITK_EXPORT RTStructStatisticsGenericFilter:
+    public clitk::ImageToImageGenericFilter<RTStructStatisticsGenericFilter<args_info_type> > {
+
+  public:
+
+    // Constructor
+    RTStructStatisticsGenericFilter ();
+
+    // Types
+    typedef RTStructStatisticsGenericFilter        Self;
+    typedef ImageToImageGenericFilterBase   Superclass;
+    typedef itk::SmartPointer<Self>         Pointer;
+    typedef itk::SmartPointer<const Self>   ConstPointer;
+
+    // New
+    itkNewMacro(Self);
+
+
+
+    //--------------------------------------------------------------------
+    void SetArgsInfo(const args_info_type & a);
+
+    //--------------------------------------------------------------------
+    // Main function called each time the filter is updated
+    template<class InputImageType>
+    void UpdateWithInputImageType();
+
+  protected:
+    template<unsigned int Dim> void InitializeImageType();
+    args_info_type mArgsInfo;
+
+  }; // end class RTStructStatisticsGenericFilter
+
+} // end namespace
+//--------------------------------------------------------------------
+
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkRTStructStatisticsGenericFilter.txx"
+#endif
+
+#endif //#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_H
+
diff --git a/tools/clitkRTStructStatisticsGenericFilter.txx b/tools/clitkRTStructStatisticsGenericFilter.txx
new file mode 100644 (file)
index 0000000..3657b50
--- /dev/null
@@ -0,0 +1,124 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKRTSTRUCTSTATISTICSGENERICFILTER_TXX
+#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_TXX
+
+#include "clitkImageCommon.h"
+
+#include "itkConnectedComponentImageFilter.h"
+#include "itkLabelImageToShapeLabelMapFilter.h"
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+RTStructStatisticsGenericFilter<args_info_type>::RTStructStatisticsGenericFilter()
+  :ImageToImageGenericFilter<Self>("RTStructStatisticsGenericFilter")
+{
+  InitializeImageType<2>();
+  InitializeImageType<3>();
+  InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void RTStructStatisticsGenericFilter<args_info_type>::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void RTStructStatisticsGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
+{
+  mArgsInfo=a;
+
+  // Set value
+  this->SetIOVerbose(mArgsInfo.verbose_flag);
+
+  if (mArgsInfo.input_given) this->AddInputFilename(mArgsInfo.input_arg);
+
+  }
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class ImageType>
+void RTStructStatisticsGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+  // Read mask input
+  typedef itk::Image<unsigned char, ImageType::ImageDimension> MaskInputImageType;
+  typename MaskInputImageType::Pointer mask;
+  mask = this->template GetInput<MaskInputImageType>(0);
+
+  //Create the Shape Label Map from the mask
+  typedef itk::Image< unsigned char, ImageType::ImageDimension > OutputImageType;
+  typedef itk::ShapeLabelObject< unsigned char, ImageType::ImageDimension > ShapeLabelObjectType;
+  typedef itk::LabelMap< ShapeLabelObjectType > LabelMapType;
+  typedef itk::ConnectedComponentImageFilter <MaskInputImageType, OutputImageType > ConnectedComponentImageFilterType;
+  typedef itk::LabelImageToShapeLabelMapFilter< OutputImageType, LabelMapType> I2LType;
+
+  typename ConnectedComponentImageFilterType::Pointer connected = ConnectedComponentImageFilterType::New ();
+  connected->SetInput(mask);
+  connected->FullyConnectedOn();
+  connected->Update();
+
+  //Create a map to contain all connectedComponent (even a little pixel)
+  typename I2LType::Pointer i2l = I2LType::New();
+  i2l->SetInput( connected->GetOutput() );
+  i2l->SetComputePerimeter(true);
+  i2l->Update();
+
+  // Retrieve the biggest component
+  LabelMapType *labelMap = i2l->GetOutput();
+  int largestComponent(0);
+  int nbPixel(0);
+  for (unsigned int n = 0; n < labelMap->GetNumberOfLabelObjects(); ++n)
+  {
+    ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(n);
+    if (labelObject->GetNumberOfPixels() > nbPixel)
+    {
+        nbPixel = labelObject->GetNumberOfPixels();
+        largestComponent = n;
+    }
+  }
+
+  //Write statitistics on the largest component
+  ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(largestComponent);
+  std::cout << " Centroid position (mm): " << std::endl;
+  std::cout << labelObject->GetCentroid()[0] << std::endl;
+  std::cout << labelObject->GetCentroid()[1] << std::endl;
+  std::cout << labelObject->GetCentroid()[2] << std::endl;
+  std::cout << " Roundness: " << std::endl;
+  std::cout << labelObject->GetRoundness() << std::endl;
+
+}
+//--------------------------------------------------------------------
+
+
+
+} // end namespace
+
+#endif  //#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_TXX
diff --git a/tools/clitkSUVPeak.cxx b/tools/clitkSUVPeak.cxx
new file mode 100644 (file)
index 0000000..0ad4000
--- /dev/null
@@ -0,0 +1,46 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKSUVPEAK_CXX
+#define CLITKSUVPEAK_CXX
+
+// clitk include
+#include "clitkSUVPeak_ggo.h"
+#include "clitkSUVPeakGenericFilter.h"
+#include "clitkIO.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkSUVPeak, args_info);
+  CLITK_INIT;
+
+  // Creation of a generic filter
+  typedef clitk::SUVPeakGenericFilter<args_info_clitkSUVPeak> FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  // Go !
+  filter->SetArgsInfo(args_info);
+  CLITK_TRY_CATCH_EXIT(filter->Update());
+
+  // this is the end my friend
+  return EXIT_SUCCESS;
+} // end main
+
+#endif //define CLITKSUVPEAK_CXX
diff --git a/tools/clitkSUVPeak.ggo b/tools/clitkSUVPeak.ggo
new file mode 100644 (file)
index 0000000..051a31e
--- /dev/null
@@ -0,0 +1,15 @@
+#File clitkSUVPeak.ggo
+package "clitkSUVPeak"
+version "2.0"
+purpose "This tool Compute the SUV Peak.
+The output is the position of the SUV Peak (in mm) and its value.
+The filter use a normalized sphere of 1 cc with 1 for voxel inside, 0 for outside.
+And for voxels that intercepted the sphere, it computes the intersection volume using Monte Carlo simulation."
+
+option "config"       - "Config file"                         string  no
+option "verbose"      v "Verbose"                             flag    off
+
+option "input"        i "Input first image filename"          string  yes
+option "mask"         m "Mask image filename (uchar)"         string  no
+option "allow_resize" r "Resize mask if different from input" flag    off
+option "volume"       - "Volume of the filter in cc"          double  default="1" no
diff --git a/tools/clitkSUVPeakGenericFilter.cxx b/tools/clitkSUVPeakGenericFilter.cxx
new file mode 100644 (file)
index 0000000..49576dc
--- /dev/null
@@ -0,0 +1,31 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKSUVPEAKGENERICFILTER_CXX
+#define CLITKSUVPEAKGENERICFILTER_CXX
+
+#include "clitkSUVPeakGenericFilter.h"
+
+namespace clitk {
+  // Specialisation
+//   template<>
+//   class SUVPeakGenericFilter<args_info_clitkSUVPeak>;
+
+
+}
+
+#endif //define CLITKSUVPEAKGENERICFILTER_CXX
diff --git a/tools/clitkSUVPeakGenericFilter.h b/tools/clitkSUVPeakGenericFilter.h
new file mode 100644 (file)
index 0000000..6357167
--- /dev/null
@@ -0,0 +1,89 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKSUVPEAKGENERICFILTER_H
+#define CLITKSUVPEAKGENERICFILTER_H
+/**
+ -------------------------------------------------------------------
+ * @file   clitkSUVPeakGenericFilter.h
+ * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
+ * @date   23 Feb 2008 08:37:53
+
+ * @brief
+ -------------------------------------------------------------------*/
+
+// clitk include
+#include "clitkCommon.h"
+#include "clitkImageToImageGenericFilter.h"
+#include "clitkSUVPeak_ggo.h"
+
+// itk include
+#include "itkImage.h"
+#include "itkImageIOBase.h"
+#include "itkImageRegionIterator.h"
+#include "itkImageRegionConstIterator.h"
+
+//--------------------------------------------------------------------
+namespace clitk {
+
+  template<class args_info_type>
+  class ITK_EXPORT SUVPeakGenericFilter:
+    public clitk::ImageToImageGenericFilter<SUVPeakGenericFilter<args_info_type> > {
+
+  public:
+
+    // Constructor
+    SUVPeakGenericFilter ();
+
+    // Types
+    typedef SUVPeakGenericFilter        Self;
+    typedef ImageToImageGenericFilterBase   Superclass;
+    typedef itk::SmartPointer<Self>         Pointer;
+    typedef itk::SmartPointer<const Self>   ConstPointer;
+
+    // New
+    itkNewMacro(Self);
+
+
+
+    //--------------------------------------------------------------------
+    void SetArgsInfo(const args_info_type & a);
+
+    //SUVPeak
+    template<class ImageType> typename ImageType::Pointer ComputeMeanFilterKernel(const typename ImageType::SpacingType & spacing, double radius);
+
+    //--------------------------------------------------------------------
+    // Main function called each time the filter is updated
+    template<class InputImageType>
+    void UpdateWithInputImageType();
+
+  protected:
+    template<unsigned int Dim> void InitializeImageType();
+    args_info_type mArgsInfo;
+
+  }; // end class SUVPeakGenericFilter
+
+} // end namespace
+//--------------------------------------------------------------------
+
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkSUVPeakGenericFilter.txx"
+#endif
+
+#endif //#define CLITKSUVPEAKGENERICFILTER_H
+
diff --git a/tools/clitkSUVPeakGenericFilter.txx b/tools/clitkSUVPeakGenericFilter.txx
new file mode 100644 (file)
index 0000000..893750d
--- /dev/null
@@ -0,0 +1,262 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKSUVPEAKGENERICFILTER_TXX
+#define CLITKSUVPEAKGENERICFILTER_TXX
+
+#include "clitkImageCommon.h"
+#include "clitkCropLikeImageFilter.h"
+#include "clitkResampleImageWithOptionsFilter.h"
+
+#include <itkConvolutionImageFilter.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+SUVPeakGenericFilter<args_info_type>::SUVPeakGenericFilter()
+  :ImageToImageGenericFilter<Self>("SUVPeakGenericFilter")
+{
+  InitializeImageType<2>();
+  InitializeImageType<3>();
+  InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void SUVPeakGenericFilter<args_info_type>::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void SUVPeakGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
+{
+  mArgsInfo=a;
+
+  // Set value
+  this->SetIOVerbose(mArgsInfo.verbose_flag);
+
+  if (mArgsInfo.input_given) this->AddInputFilename(mArgsInfo.input_arg);
+
+  if (mArgsInfo.mask_given)  this->AddInputFilename(mArgsInfo.mask_arg);
+  }
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class ImageType>
+void SUVPeakGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+  // Read input
+  typename ImageType::Pointer input = this->template GetInput<ImageType>(0);
+
+  //Read mask
+  typedef itk::Image<unsigned char, ImageType::ImageDimension> MaskImageType;
+  typename MaskImageType::Pointer mask;
+  if(mArgsInfo.mask_given) {
+      mask = this->template GetInput<MaskImageType>(1);
+      // Check mask sampling/size
+      if (!HaveSameSizeAndSpacing<MaskImageType, ImageType>(mask, input)) {
+        if (mArgsInfo.allow_resize_flag) {
+          if (mArgsInfo.verbose_flag) {
+            std::cout << "Resize mask image like input" << std::endl;
+          }
+          typedef clitk::ResampleImageWithOptionsFilter<MaskImageType> ResamplerType;
+          typename ResamplerType::Pointer resampler = ResamplerType::New();
+          resampler->SetInput(mask); //By default the interpolation in NN, Ok for mask
+          resampler->SetOutputSpacing(input->GetSpacing());
+          resampler->SetOutputOrigin(mask->GetOrigin());
+          resampler->SetGaussianFilteringEnabled(false);
+          resampler->Update();
+          mask = resampler->GetOutput();
+
+          typedef clitk::CropLikeImageFilter<MaskImageType> FilterType;
+          typename FilterType::Pointer crop = FilterType::New();
+          crop->SetInput(mask);
+          crop->SetCropLikeImage(input);
+          crop->Update();
+          mask = crop->GetOutput();
+
+        }
+        else {
+          std::cerr << "Mask image has a different size/spacing than input. Abort. (Use option --allow_resize)" << std::endl;
+          exit(-1);
+        }
+      }
+  }
+  else {
+      mask = MaskImageType::New();
+      mask->SetRegions(input->GetLargestPossibleRegion());
+      mask->SetOrigin(input->GetOrigin());
+      mask->SetSpacing(input->GetSpacing());
+      mask->Allocate();
+      mask->FillBuffer(1);
+  }
+
+  double volume = 1000; //1 cc into mc
+  if (mArgsInfo.volume_given)
+    volume *= mArgsInfo.volume_arg;
+  const double PI = 3.141592653589793238463;
+  double radius = std::pow(3*volume/(4*PI),1./3);
+
+  typename ImageType::Pointer kernel = ComputeMeanFilterKernel<ImageType>(input->GetSpacing(), radius);
+
+  // Perform the convolution
+  typedef itk::ConvolutionImageFilter<ImageType> FilterType;
+  typename FilterType::Pointer filter = FilterType::New();
+  filter->SetInput(input);
+  filter->SetKernelImage(kernel);
+  filter->Update();
+  typename ImageType::Pointer output = filter->GetOutput();
+
+
+  typedef itk::ImageRegionConstIteratorWithIndex<ImageType> IteratorType;
+  typedef itk::ImageRegionConstIteratorWithIndex<MaskImageType> MIteratorType;
+  IteratorType iters(output, output->GetLargestPossibleRegion());
+  MIteratorType iterm(mask, mask->GetLargestPossibleRegion());
+  iters.GoToBegin();
+  iterm.GoToBegin();
+  double max = 0.0;
+  typename ImageType::IndexType index;
+  while (!iters.IsAtEnd()) {
+    if (iterm.Get() == 1) { // inside the mask
+      if (iters.Get() > max) {
+        max = iters.Get();
+        index = iters.GetIndex();
+      }
+    }
+    ++iters;
+    ++iterm;
+  }
+  typename ImageType::PointType p;
+  output->TransformIndexToPhysicalPoint(index, p);
+  std::cout<<"SUV Peak found in "<< p << " mm with the value " << max << std::endl;
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class ImageType>
+typename ImageType::Pointer
+SUVPeakGenericFilter<args_info_type>::ComputeMeanFilterKernel(const typename ImageType::SpacingType & spacing, double radius)
+{
+  // Some kind of cache to speed up a bit
+  static std::map<double, typename ImageType::Pointer> cache;
+  if (cache.find(radius) != cache.end()) {
+    return cache.find(radius)->second;
+  }
+
+  // Compute a kernel that corresponds to a sphere with 1 inside, 0
+  // outside and in between proportional to the intersection between
+  // the pixel and the sphere. Computed by Monte-Carlo because I don't
+  // know an equation that compute the intersection volume between a
+  // box and a sphere ...
+  //auto kernel = ImageType::New();
+  typename ImageType::Pointer kernel = ImageType::New();
+
+  // Size of the kernel in pixel (minimum 3 pixels)
+  typename ImageType::SizeType size;
+  size[0] = std::max((int)ceil(radius*2/spacing[0]), 3);
+  size[1] = std::max((int)ceil(radius*2/spacing[1]), 3);
+  size[2] = std::max((int)ceil(radius*2/spacing[2]), 3);
+
+  // Compute the region, such as the origin is at the center
+  typename ImageType::IndexType start;
+  start.Fill(0);
+  typename ImageType::RegionType region;
+  region.SetSize(size);
+  region.SetIndex(start);
+  kernel->SetRegions(region);
+  kernel->SetSpacing(spacing);
+  typename ImageType::PointType origin;
+  origin[0] = -(double)size[0]/2.0*spacing[0]+spacing[0]/2.0;
+  origin[1] = -(double)size[1]/2.0*spacing[1]+spacing[1]/2.0;
+  origin[2] = -(double)size[2]/2.0*spacing[2]+spacing[2]/2.0;
+  kernel->SetOrigin(origin);
+  kernel->Allocate();
+
+  // Fill the kernel
+  itk::ImageRegionIteratorWithIndex<ImageType> iter(kernel, region);
+  typename ImageType::PointType center;
+  center.Fill(0.0);
+  typename ImageType::PointType hh; // half a voxel
+  hh[0] = spacing[0]/2.0;
+  hh[1] = spacing[1]/2.0;
+  hh[2] = spacing[2]/2.0;
+  double h = hh.EuclideanDistanceTo(center); // distance of half a pixel to its center.
+  std::srand(time(NULL));
+  double sum = 0.0;
+  while (!iter.IsAtEnd()) {
+    typename ImageType::IndexType index = iter.GetIndex();
+    typename ImageType::PointType p;
+    kernel->TransformIndexToPhysicalPoint(index, p);
+    double d = p.EuclideanDistanceTo(center) + h;
+    if (d<radius) { // inside the sphere
+      iter.Set(1.0);
+      sum += 1.0;
+    }
+    else { // the box intersect the sphere. We randomly pick point in
+           // the box and compute the probability to be in/out the
+           // sphere
+      int n = 500; // number of samples
+      double w = 0.0;
+      //for(auto i=0; i<n; i++) {
+      for(int i=0; i<n; i++) {
+        // random position inside the current pixel
+        typename ImageType::PointType pos;
+        pos[0] = p[0]+(((double)std::rand()/(double)RAND_MAX)-0.5)*spacing[0];
+        pos[1] = p[1]+(((double)std::rand()/(double)RAND_MAX)-0.5)*spacing[1];
+        pos[2] = p[2]+(((double)std::rand()/(double)RAND_MAX)-0.5)*spacing[2];
+        // distance to center
+        double distance = pos.EuclideanDistanceTo(center);
+        // lower/greater than radius
+        if (distance < radius) w += 1.0;
+      }
+      w = w/(double)n;
+      iter.Set(w);
+      sum += w;
+    }
+    ++iter;
+  }
+
+  // Normalize
+  iter.GoToBegin();
+  while (!iter.IsAtEnd()) {
+    iter.Set(iter.Get()/sum);
+    ++iter;
+  }
+
+  // Put in cache
+  cache[radius] = kernel;
+
+  return kernel;
+}
+//--------------------------------------------------------------------
+
+} // end namespace
+
+#endif  //#define CLITKSUVPEAKGENERICFILTER_TXX
diff --git a/tools/clitkScintivolStats.cxx b/tools/clitkScintivolStats.cxx
new file mode 100644 (file)
index 0000000..af197f7
--- /dev/null
@@ -0,0 +1,214 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef CLITKSCINTIVOLSTATS_CXX
+#define CLITKSCINTIVOLSTATS_CXX
+
+// clitk include
+#include "clitkScintivolStats_ggo.h"
+#include "clitkIO.h"
+#include "clitkImageCommon.h"
+#include "clitkCommon.h"
+
+#include "itkImageFileReader.h"
+#include "itkBinaryImageToLabelMapFilter.h"
+#include "itkLabelMapToLabelImageFilter.h"
+#include "itkLabelStatisticsImageFilter.h"
+#include "itkStatisticsImageFilter.h"
+#include "itkExtractImageFilter.h"
+
+#include <iostream>
+
+//-------------------------------------------------------------------=
+int main(int argc, char * argv[])
+{
+
+  // init command line
+  GGO(clitkScintivolStats, args_info);
+  CLITK_INIT;
+
+  typedef itk::Image<double, 3> Input3DType;
+  typedef itk::Image<double, 2> Input2DType;
+  typedef itk::Image<char, 3> Input3DMaskType;
+  typedef itk::Image<char, 2> Input2DMaskType;
+  typedef itk::ImageFileReader<Input3DType> InputReader3DType;
+  typedef itk::ImageFileReader<Input3DMaskType> InputReader3DMaskType;
+  typedef itk::ImageFileReader<Input2DMaskType> InputReader2DMaskType;
+  typedef itk::LabelStatisticsImageFilter<Input3DType, Input3DMaskType> LabelStatistics3DImageFilterType;
+  typedef itk::LabelStatisticsImageFilter<Input2DType, Input2DMaskType> LabelStatistics2DImageFilterType;
+  typedef itk::StatisticsImageFilter<Input2DType> Statistics2DImageFilterType;
+  typedef itk::ExtractImageFilter<Input3DType, Input2DType> ExtractImageFilter;
+
+  //Determine nbAcquisitionDynamic1 and nbAcquisitionDynamic2 (ie. the number of slice in dynamic1 and dynamic2)
+  //Start to open the dynamic1 and dynamic2 and get the 3rd dimension size
+  InputReader3DType::Pointer readerDynamic1 = InputReader3DType::New();
+  readerDynamic1->SetFileName(args_info.dynamic1_arg);
+  readerDynamic1->Update();
+  Input3DType::Pointer dynamic1 = readerDynamic1->GetOutput();
+  int nbAcquisitionDynamic1 = dynamic1->GetLargestPossibleRegion().GetSize()[2];
+
+  InputReader3DType::Pointer readerDynamic2 = InputReader3DType::New();
+  readerDynamic2->SetFileName(args_info.dynamic2_arg);
+  readerDynamic2->Update();
+  Input3DType::Pointer dynamic2 = readerDynamic2->GetOutput();
+  int nbAcquisitionDynamic2 = dynamic2->GetLargestPossibleRegion().GetSize()[2];
+
+  //Open the csv file
+  //If it's scatter or attenuation correction, just append results to the csv file
+  //If not open it normally and write the number of dynamic acquisition for the first and the second images (given by the ggo and from the dicom tag)
+  std::ofstream csvFile;
+  if (args_info.append_flag)
+    csvFile.open (args_info.output_arg, std::ios::app);
+  else {
+    csvFile.open (args_info.output_arg);
+    csvFile << "1;" << nbAcquisitionDynamic1 << ";" << nbAcquisitionDynamic2 << "\n";
+  }
+
+  //Read Tomo image, total and remnant masks
+  InputReader3DType::Pointer readerTomo = InputReader3DType::New();
+  readerTomo->SetFileName(args_info.tomo_arg);
+  readerTomo->Update();
+  Input3DType::Pointer tomo = readerTomo->GetOutput();
+
+  InputReader3DMaskType::Pointer readerTotalLiver = InputReader3DMaskType::New();
+  readerTotalLiver->SetFileName(args_info.totalLiverMask_arg);
+  readerTotalLiver->Update();
+
+  InputReader3DMaskType::Pointer readerRemnantLiver = InputReader3DMaskType::New();
+  readerRemnantLiver->SetFileName(args_info.remnantLiverMask_arg);
+  readerRemnantLiver->Update();
+
+  //Find number of counts in tomo for total Liver and remnant Liver
+  LabelStatistics3DImageFilterType::Pointer labelStatisticsImageFilterTotalLiver = LabelStatistics3DImageFilterType::New();
+  labelStatisticsImageFilterTotalLiver->SetLabelInput(readerTotalLiver->GetOutput());
+  labelStatisticsImageFilterTotalLiver->SetInput(tomo);
+  labelStatisticsImageFilterTotalLiver->Update();
+
+  LabelStatistics3DImageFilterType::Pointer labelStatisticsImageFilterRemnantLiver = LabelStatistics3DImageFilterType::New();
+  labelStatisticsImageFilterRemnantLiver->SetLabelInput(readerRemnantLiver->GetOutput());
+  labelStatisticsImageFilterRemnantLiver->SetInput(tomo);
+  labelStatisticsImageFilterRemnantLiver->Update();
+
+  //Write them in the csv file
+  csvFile << args_info.acquisitionTimeTomo_arg << ";" << labelStatisticsImageFilterTotalLiver->GetSum(1) << ";" << labelStatisticsImageFilterRemnantLiver->GetSum(1) << "\n";
+
+  //Read liver and heart masks for dynamic1
+  InputReader2DMaskType::Pointer readerLiver = InputReader2DMaskType::New();
+  readerLiver->SetFileName(args_info.liverMask_arg);
+  readerLiver->Update();
+
+  InputReader2DMaskType::Pointer readerHeart = InputReader2DMaskType::New();
+  readerHeart->SetFileName(args_info.heartMask_arg);
+  readerHeart->Update();
+
+  for (unsigned int i=0; i<nbAcquisitionDynamic1; ++i) {
+    //Compute time frame in s
+    double timeFrame = args_info.frameDurationDynamic1_arg * i + args_info.frameDurationDynamic1_arg;
+
+    //Extract the Region of interest of the dynamic1
+    ExtractImageFilter::Pointer extractSlice = ExtractImageFilter::New();
+    Input3DType::IndexType start;
+    start[0] = 0;
+    start[1] = 0;
+    start[2] = i;
+    Input3DType::SizeType size;
+    size[0] = dynamic1->GetLargestPossibleRegion().GetSize()[0];
+    size[1] = dynamic1->GetLargestPossibleRegion().GetSize()[1];
+    size[2] = 0;
+    Input3DType::RegionType desiredRegion;
+    desiredRegion.SetSize(size);
+    desiredRegion.SetIndex(start);
+    extractSlice->SetExtractionRegion(desiredRegion);
+    extractSlice->SetInput(dynamic1);
+#if ITK_VERSION_MAJOR >= 4
+    extractSlice->SetDirectionCollapseToIdentity();
+#endif
+    extractSlice->Update();
+
+    //Find number of counts in dynamic1 slice for Liver and heart
+    LabelStatistics2DImageFilterType::Pointer labelStatisticsImageFilterLiver = LabelStatistics2DImageFilterType::New();
+    labelStatisticsImageFilterLiver->SetLabelInput(readerLiver->GetOutput());
+    labelStatisticsImageFilterLiver->SetInput(extractSlice->GetOutput());
+    labelStatisticsImageFilterLiver->SetCoordinateTolerance(0.001);
+    labelStatisticsImageFilterLiver->SetDirectionTolerance(0.001);
+    labelStatisticsImageFilterLiver->Update();
+
+    LabelStatistics2DImageFilterType::Pointer labelStatisticsImageFilterHeart = LabelStatistics2DImageFilterType::New();
+    labelStatisticsImageFilterHeart->SetLabelInput(readerHeart->GetOutput());
+    labelStatisticsImageFilterHeart->SetInput(extractSlice->GetOutput());
+    labelStatisticsImageFilterHeart->SetCoordinateTolerance(0.001);
+    labelStatisticsImageFilterHeart->SetDirectionTolerance(0.001);
+    labelStatisticsImageFilterHeart->Update();
+
+    //Find number of counts in dynamic1 slice
+    Statistics2DImageFilterType::Pointer statisticsImageFilterDynamic1 = Statistics2DImageFilterType::New();
+    statisticsImageFilterDynamic1->SetInput(extractSlice->GetOutput());
+    statisticsImageFilterDynamic1->Update();
+
+    //Write them in the csv file
+    csvFile << timeFrame << ";" << labelStatisticsImageFilterLiver->GetSum(1) << ";" << labelStatisticsImageFilterHeart->GetSum(1) << ";" << statisticsImageFilterDynamic1->GetSum() << "\n";
+  }
+
+  //Read parenchyma mask for dynamic2
+  InputReader2DMaskType::Pointer readerParenchyma = InputReader2DMaskType::New();
+  readerParenchyma->SetFileName(args_info.parenchymaMask_arg);
+  readerParenchyma->Update();
+
+  for (unsigned int i=0; i<nbAcquisitionDynamic2; ++i) {
+    //Compute time frame in s
+    double timeFrame = args_info.frameDurationDynamic2_arg * i + args_info.acquisitionTimeDynamic2_arg + args_info.frameDurationDynamic2_arg;
+
+    //Extract the Region of interest of the dynamic1
+    ExtractImageFilter::Pointer extractSlice = ExtractImageFilter::New();
+    Input3DType::IndexType start;
+    start[0] = 0;
+    start[1] = 0;
+    start[2] = i;
+    Input3DType::SizeType size;
+    size[0] = dynamic2->GetLargestPossibleRegion().GetSize()[0];
+    size[1] = dynamic2->GetLargestPossibleRegion().GetSize()[1];
+    size[2] = 0;
+    Input3DType::RegionType desiredRegion;
+    desiredRegion.SetSize(size);
+    desiredRegion.SetIndex(start);
+    extractSlice->SetExtractionRegion(desiredRegion);
+    extractSlice->SetInput(dynamic2);
+#if ITK_VERSION_MAJOR >= 4
+    extractSlice->SetDirectionCollapseToIdentity();
+#endif
+    extractSlice->Update();
+
+    //Find number of counts in dynamic2 slice for parenchyma
+    LabelStatistics2DImageFilterType::Pointer labelStatisticsImageFilterParenchyma = LabelStatistics2DImageFilterType::New();
+    labelStatisticsImageFilterParenchyma->SetLabelInput(readerParenchyma->GetOutput());
+    labelStatisticsImageFilterParenchyma->SetInput(extractSlice->GetOutput());
+    labelStatisticsImageFilterParenchyma->SetCoordinateTolerance(0.001);
+    labelStatisticsImageFilterParenchyma->SetDirectionTolerance(0.001);
+    labelStatisticsImageFilterParenchyma->Update();
+
+    //Write them in the csv file
+    csvFile << timeFrame << ";" << labelStatisticsImageFilterParenchyma->GetSum(1) << "\n";
+  }
+
+  csvFile.close();
+
+  // this is the end my friend
+  return 0;
+}
+//-------------------------------------------------------------------=
+
+#endif /* end #define CLITKSCINTIVOLSTATS_CXX */
diff --git a/tools/clitkScintivolStats.ggo b/tools/clitkScintivolStats.ggo
new file mode 100644 (file)
index 0000000..e99d9ab
--- /dev/null
@@ -0,0 +1,23 @@
+# file clitkScintivolStats.ggo
+package "clitkScintivolStats"
+version "1.0"
+purpose "Convert an image into another image.\n\tAllow to change the file format and/or the pixel type. \n\tKnown file formats 2D: jpeg png bmp tif mhd hdr vox dcm \n\tKnown file formats 3D: mhd vox hdr dcm\n\tKnown file formats 4D: mhd \n\tKnown images: 2D 3D or 4D, schar, uchar, short, ushort, int, float and double\n\nIf the -o option is not given, the last parameter of the command line is used as output."
+
+option "config"      - "Config file"                                                       string no
+option "output"      o "Output .csv filename"                                               string yes
+option "append"      - "Append results to .csv file (eg: for scatter)"                      flag   off
+
+option "dynamic1"              - "Dynamique 1 filename (geometrical mean)"                string yes
+option "frameDurationDynamic1" - "Frame duration for dynamique 1"                         double yes
+option "heartMask"               - "Heart mask filename"                                    string yes
+option "liverMask"               - "Liver mask filename"                                    string yes
+
+option "dynamic2"              - "Dynamique 2 filename (geometrical mean)"                string yes
+option "frameDurationDynamic2" - "Frame duration for dynamique 2"                         double yes
+option "acquisitionTimeDynamic2" - "Start acquisition time of the dynamic2 after dynamic1"  double yes
+option "parenchymaMask"          - "Parenchyma mask filename"                               string yes
+
+option "tomo"                    - "Tomo image filename"                                    string yes
+option "acquisitionTimeTomo"     - "Acquisition time for tomo"                              double yes
+option "totalLiverMask"          - "Total liver mask filename"                              string yes
+option "remnantLiverMask"        - "Remnant liver mask filename"                            string yes
index ed6f89e8491f488480c819bbe38ee867281b0d8f..e5b55dd1a77c61c0735871c662003962b5e1ad03 100755 (executable)
@@ -4,27 +4,11 @@ MAKE="make --jobs=$NUM_THREADS --keep-going"
 
 #Prepare cmake arguments following the ITK version
 if [ "$C11" == "true" ]; then
-  if [ "$ITK_VERSION" == "4.6" ]; then
-    itk_repo_str=" --branch v4.6.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-    cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
-  elif [ "$ITK_VERSION" == "4.9.1" ]; then
-    itk_repo_str=" --branch v4.9.1 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-    cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
-  elif [ "$ITK_VERSION" == "4.13.0" ]; then
-    itk_repo_str=" --branch v4.13.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-    cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
-  fi
+  itk_repo_str=" --branch "$ITK_VERSION" https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
+  cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
 else
-  if [ "$ITK_VERSION" == "4.6" ]; then
-    itk_repo_str=" --branch v4.6.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-    cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
-  elif [ "$ITK_VERSION" == "4.9.1" ]; then
-    itk_repo_str=" --branch v4.9.1 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-    cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
-  elif [ "$ITK_VERSION" == "4.13.0" ]; then
-    itk_repo_str=" --branch v4.13.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-    cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
-  fi
+  itk_repo_str=" --branch "$ITK_VERSION" https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
+  cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
 fi
 
 if [ -d $ITK_SOURCE_DIR ]; then
index 7fffb00413c3586e2ad3b62ee0c40db49d3cbf62..12e137bcc21a01f35424ede97b81d0ff868be625 100755 (executable)
@@ -7,7 +7,7 @@ if [ "$QT_VERSION" == "4.8.7" ]; then
 elif [ "$QT_VERSION" == "5.5.1" ]; then
   if test $TRAVIS_OS_NAME == linux ; then sudo add-apt-repository --yes ppa:beineri/opt-qt551-trusty; fi
   if test $TRAVIS_OS_NAME == linux ; then sudo apt-get update -qq; fi
-  if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt55tools; fi
+  if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt55tools qt55x11extras; fi
 fi
 if test $TRAVIS_OS_NAME == osx ; then brew install qt5; fi
 if test $TRAVIS_OS_NAME == osx ; then brew link qt5 --force; fi
index f4dbf32532edc1766cabc8ada6d2ff99a86cf66f..9d36bdba3d76134a3bb0f3995bf2423e62e355ea 100755 (executable)
@@ -10,8 +10,8 @@ fi
 
 #Prepare cmake arguments following the VTK version
 if [ "$C11" == "true" ]; then
-  if [ "$VTK_VERSION" == "5.10" ]; then
-  vtk_repo_str=" --branch v5.10.0 https://github.com/Kitware/VTK.git --depth 1"
+  vtk_repo_str=" --branch "$VTK_VERSION" https://github.com/Kitware/VTK.git --depth 1"
+  if [ "$VTK_VERSION" == "v5.10.0" ]; then
   cmake_arg_str=" $cmake_arg_str
     -DCMAKE_CXX_FLAGS=-std=c++11
     -DBUILD_SHARED_LIBS=1
@@ -23,8 +23,7 @@ if [ "$C11" == "true" ]; then
     -DVTK_USE_RENDERING=ON
     -DVTK_USE_VIEWS=ON
     -DVTK_QT_VERSION="$QT_MAJOR_VERSION" "
-  elif [ "$VTK_VERSION" == "6.3" ]; then
-  vtk_repo_str=" --branch v6.3.0 https://github.com/Kitware/VTK.git --depth 1"
+  elif [ "$VTK_VERSION" == "v6.3.0" ] || [ "$VTK_VERSION" == "v8.1.1" ]; then
   cmake_arg_str=" $cmake_arg_str
     -DCMAKE_CXX_FLAGS=-std=c++11
     -DBUILD_SHARED_LIBS=1
@@ -45,8 +44,7 @@ if [ "$C11" == "true" ]; then
     -DModule_vtkRenderingQt=ON
     -DModule_vtkViewsQt=ON
     -DVTK_QT_VERSION="$QT_MAJOR_VERSION" "
-  elif [ "$VTK_VERSION" == "7.0.0" ]; then
-  vtk_repo_str=" --branch v7.0.0 https://github.com/Kitware/VTK.git --depth 1"
+  elif [ "$VTK_VERSION" == "v7.0.0" ]; then
   cmake_arg_str=" $cmake_arg_str
     -DCMAKE_CXX_FLAGS=-std=c++11
     -DBUILD_SHARED_LIBS=1
@@ -70,8 +68,8 @@ if [ "$C11" == "true" ]; then
     -DVTK_QT_VERSION="$QT_MAJOR_VERSION" "
   fi
 else
-  if [ "$VTK_VERSION" == "5.10" ]; then
-  vtk_repo_str=" --branch v5.10.0 https://github.com/Kitware/VTK.git --depth 1"
+  vtk_repo_str=" --branch "$VTK_VERSION" https://github.com/Kitware/VTK.git --depth 1"
+  if [ "$VTK_VERSION" == "v5.10.0" ]; then
   cmake_arg_str=" $cmake_arg_str
     -DBUILD_SHARED_LIBS=1
     -DCMAKE_BUILD_TYPE=Release
@@ -82,8 +80,7 @@ else
     -DVTK_USE_RENDERING=ON
     -DVTK_USE_VIEWS=ON
     -DVTK_QT_VERSION="$QT_MAJOR_VERSION" "
-  elif [ "$VTK_VERSION" == "6.3" ]; then
-  vtk_repo_str=" --branch v6.3.0 https://github.com/Kitware/VTK.git --depth 1"
+  elif [ "$VTK_VERSION" == "v6.3.0" ] || [ "$VTK_VERSION" == "v8.1.1" ]; then
   cmake_arg_str=" $cmake_arg_str
     -DBUILD_SHARED_LIBS=1
     -DCMAKE_BUILD_TYPE=Release
@@ -103,8 +100,7 @@ else
     -DModule_vtkRenderingQt=ON
     -DModule_vtkViewsQt=ON
     -DVTK_QT_VERSION="$QT_MAJOR_VERSION" "
-  elif [ "$VTK_VERSION" == "7.0.0" ]; then
-  vtk_repo_str=" --branch v7.0.0 https://github.com/Kitware/VTK.git --depth 1"
+  elif [ "$VTK_VERSION" == "v7.0.0" ]; then
   cmake_arg_str=" $cmake_arg_str
     -DBUILD_SHARED_LIBS=1
     -DCMAKE_BUILD_TYPE=Release
index fe6120ec7e47c80058f5de72391c75d19ed10e12..9453e1b0362114fecc112a6a3e1b9ec21b81c992 100644 (file)
@@ -26,8 +26,6 @@ set(vv_TOOLS
   vvToolConvert ## with dummy vvToolConvert.ui
   vvToolROIManager
   vvToolSegmentation
-  vvToolProfile
-  vvToolHistogram
   ## these ones are for tests (not working)
   # vvToolTest
   # vvToolFoo
@@ -39,6 +37,12 @@ set(vv_TOOLS
   # vvToolExtractLung
   # vvToolStructureSetManager
 )
+#List of vv tools to compile
+#Ensure compatibility with QVTKOpenGL for VTK < v8.1 and QVTKOpenGLNativeWidget for others
+set(vv_TOOLS_VTK7
+  vvToolProfile
+  vvToolHistogram
+)
 # dependencies of the tools
 # Future issues : when tool depend on other tools ... how to manage that ?
 #  >> add the relevant $_LIBS variable to the tool that has dependencies?
@@ -65,8 +69,6 @@ set(vv_COMMON_WITH_UI
   vvOverlayPanel
   vvLandmarksPanel
   vvProgressDialog
-  vvSegmentationDialog
-  vvSurfaceViewerDialog
   vvDeformationDialog
   vvStructSelector
   vvIntensityValueSlider
@@ -76,6 +78,13 @@ set(vv_COMMON_WITH_UI
   vvToolInputSelectorWidget
   vvRegisterForm
 )
+# in COMMON_WITH_UI -> must have .h and .cxx and VTK7.ui
+#Ensure compatibility with QVTKOpenGL for VTK < v8.1 and QVTKOpenGLNativeWidget for others
+set(vv_COMMON_WITH_UI_VTK7
+  vvMainWindow
+  vvSegmentationDialog
+  vvSurfaceViewerDialog
+)
 
 # All others sources
 set(vv_SRCS
@@ -208,7 +217,7 @@ endif(CLITK_USE_PACS_CONNECTION)
   # variables in vv.cxx for the tools contained in vvLib
   if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
     file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
-    foreach(tool ${vv_TOOLS})
+    foreach(tool ${vv_TOOLS} ${vv_TOOLS_VTK7})
       file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
       file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
       file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
@@ -226,6 +235,28 @@ endif(CLITK_USE_PACS_CONNECTION)
         QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
       endif()
   endforeach(tool)
+
+  #Special case for Main Window with QVTKWidget according VTK version
+  foreach(tool ${vv_TOOLS_VTK7} ${vv_COMMON_WITH_UI_VTK7})
+      set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
+      if(VTK_VERSION VERSION_GREATER "8.0.0")
+        if(vv_QT_VERSION VERSION_GREATER "4")
+          QT5_WRAP_CPP(vv_SRCS ${tool}.h)
+          QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
+        else()
+          QT4_WRAP_CPP(vv_SRCS ${tool}.h)
+          QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
+        endif()
+      else()
+        if(vv_QT_VERSION VERSION_GREATER "4")
+          QT5_WRAP_CPP(vv_SRCS ${tool}.h)
+          QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}VTK7.ui)
+        else()
+          QT4_WRAP_CPP(vv_SRCS ${tool}.h)
+          QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}VTK7.ui)
+        endif()
+      endif()
+  endforeach(tool)
   
   # Add the common source files
   foreach(tool ${vv_COMMON})
@@ -301,7 +332,7 @@ include_directories(
 
 #=========================================================
 #Add each tool's dependencies
-foreach(tool ${vv_TOOLS})
+foreach(tool ${vv_TOOLS} ${vv_TOOLS_VTK7})
   set(toolLibs ${toolLibs} ${${tool}_LIBS})
 endforeach(tool)
 
index fa205e0798786e904a8c2042e744e32090353ed6..09050ba7c80129842382b70491a77aaf95effa38 100644 (file)
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="NOViewWidget" native="true">
+           <widget class="QVTKOpenGLNativeWidget" name="NOViewWidget" native="true">
             <property name="mouseTracking">
              <bool>true</bool>
             </property>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="SOViewWidget" native="true">
+           <widget class="QVTKOpenGLNativeWidget" name="SOViewWidget" native="true">
             <property name="mouseTracking">
              <bool>true</bool>
             </property>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="NEViewWidget" native="true">
+           <widget class="QVTKOpenGLNativeWidget" name="NEViewWidget" native="true">
             <property name="mouseTracking">
              <bool>true</bool>
             </property>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="SEViewWidget" native="true">
+           <widget class="QVTKOpenGLNativeWidget" name="SEViewWidget" native="true">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
               <horstretch>0</horstretch>
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QVTKWidget</class>
+   <class>QVTKOpenGLNativeWidget</class>
    <extends>QWidget</extends>
-   <header>QVTKWidget.h</header>
+   <header>QVTKOpenGLNativeWidget.h</header>
   </customwidget>
   <customwidget>
    <class>vvInfoPanel</class>
diff --git a/vv/qt_ui/vvMainWindowVTK7.ui b/vv/qt_ui/vvMainWindowVTK7.ui
new file mode 100644 (file)
index 0000000..fa205e0
--- /dev/null
@@ -0,0 +1,1332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvMainWindow</class>
+ <widget class="QMainWindow" name="vvMainWindow">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1008</width>
+    <height>758</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>vv : the 4D Slicer</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="../vvIcons.qrc">
+    <normaloff>:/common/icons/ducky.png</normaloff>:/common/icons/ducky.png</iconset>
+  </property>
+  <property name="statusTip">
+   <string>Type 'F1' on image to display help on navigation</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="statusTip">
+    <string>Type 'F1' on image to display help on navigation</string>
+   </property>
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <widget class="QFrame" name="frame">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>16</width>
+        <height>36</height>
+       </size>
+      </property>
+      <property name="frameShape">
+       <enum>QFrame::StyledPanel</enum>
+      </property>
+      <property name="frameShadow">
+       <enum>QFrame::Raised</enum>
+      </property>
+      <layout class="QGridLayout">
+       <property name="margin">
+        <number>2</number>
+       </property>
+       <property name="spacing">
+        <number>2</number>
+       </property>
+       <item row="0" column="0">
+        <widget class="QPushButton" name="goToCursorPushButton">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>Go to cursor</string>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="icon">
+          <iconset resource="../vvIcons.qrc">
+           <normaloff>:/common/icons/cross.png</normaloff>:/common/icons/cross.png</iconset>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="Line" name="line">
+         <property name="frameShadow">
+          <enum>QFrame::Sunken</enum>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="2">
+        <widget class="QPushButton" name="playButton">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>Play Current Image</string>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="icon">
+          <iconset resource="../vvIcons.qrc">
+           <normaloff>:/common/icons/player_play.png</normaloff>:/common/icons/player_play.png</iconset>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="5">
+        <widget class="Line" name="line_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="7">
+        <widget class="QLabel" name="windowLabel">
+         <property name="text">
+          <string>Window :</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="8">
+        <widget class="QDoubleSpinBox" name="windowSpinBox">
+         <property name="decimals">
+          <number>6</number>
+         </property>
+         <property name="minimum">
+          <double>-66000.000000000000000</double>
+         </property>
+         <property name="maximum">
+          <double>66000.000000000000000</double>
+         </property>
+         <property name="singleStep">
+          <double>10.000000000000000</double>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="9">
+        <widget class="QPushButton" name="inverseButton">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>24</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>Inverse colors</string>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="icon">
+          <iconset resource="../vvIcons.qrc">
+           <normaloff>:/common/icons/invertcolor.png</normaloff>:/common/icons/invertcolor.png</iconset>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="10">
+        <widget class="QLabel" name="levelLabel">
+         <property name="text">
+          <string> Level :</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="11">
+        <widget class="QDoubleSpinBox" name="levelSpinBox">
+         <property name="decimals">
+          <number>6</number>
+         </property>
+         <property name="minimum">
+          <double>-66000.000000000000000</double>
+         </property>
+         <property name="maximum">
+          <double>66000.000000000000000</double>
+         </property>
+         <property name="singleStep">
+          <double>10.000000000000000</double>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="12">
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>Preset :</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="13">
+        <widget class="QComboBox" name="presetComboBox">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>100</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <item>
+          <property name="text">
+           <string>Auto Scale</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Hounsfield Full Scale</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Soft Tissue</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Lungs</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Bones</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Head/Brain</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>[0,1] Scale</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>User Scale</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Ventilation Image</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="0" column="14">
+        <widget class="QLabel" name="label_4">
+         <property name="text">
+          <string>Colormap :</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="15">
+        <widget class="QComboBox" name="colorMapComboBox">
+         <item>
+          <property name="text">
+           <string>B&amp;W</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Heat</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Cold</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Dosimetry</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Full Color</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Segmentation</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Ventilation</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="0" column="21">
+        <widget class="QPushButton" name="viewButton">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>Expand window</string>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="icon">
+          <iconset resource="../vvIcons.qrc">
+           <normaloff>:/common/icons/adjustsize.png</normaloff>:/common/icons/adjustsize.png</iconset>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="4">
+        <widget class="QSpinBox" name="frameRateSpinBox">
+         <property name="minimum">
+          <number>1</number>
+         </property>
+         <property name="maximum">
+          <number>100</number>
+         </property>
+         <property name="value">
+          <number>10</number>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="3">
+        <widget class="QLabel" name="frameRateLabel">
+         <property name="text">
+          <string>Speed : </string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="16">
+        <widget class="QPushButton" name="applyWindowLevelToAllButton">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>24</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>Apply windowing to all images</string>
+         </property>
+         <property name="text">
+          <string>All</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="19">
+        <widget class="QComboBox" name="slicingPresetComboBox">
+         <item>
+          <property name="text">
+           <string>World</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Voxels</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="0" column="18">
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>Slice to</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="17">
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item row="1" column="0">
+     <widget class="QSplitter" name="splitter_4">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <widget class="QSplitter" name="splitter">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <widget class="QTabWidget" name="tabWidget">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+          <horstretch>0</horstretch>
+          <verstretch>1</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="currentIndex">
+         <number>0</number>
+        </property>
+        <widget class="QWidget" name="DataTab">
+         <attribute name="title">
+          <string>Images</string>
+         </attribute>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QTreeWidget" name="DataTree">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="horizontalScrollBarPolicy">
+             <enum>Qt::ScrollBarAsNeeded</enum>
+            </property>
+            <property name="showDropIndicator" stdset="0">
+             <bool>false</bool>
+            </property>
+            <property name="textElideMode">
+             <enum>Qt::ElideLeft</enum>
+            </property>
+            <property name="itemsExpandable">
+             <bool>true</bool>
+            </property>
+            <property name="columnCount">
+             <number>7</number>
+            </property>
+            <column>
+             <property name="text">
+              <string>1</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>2</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>3</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>4</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>Data</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>6</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>8</string>
+             </property>
+            </column>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="VFtab">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <attribute name="title">
+          <string>Overlay</string>
+         </attribute>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="vvOverlayPanel" name="overlayPanel" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="ROItab">
+         <attribute name="title">
+          <string>ROI</string>
+         </attribute>
+         <layout class="QGridLayout" name="gridLayout_2"/>
+        </widget>
+        <widget class="QWidget" name="LinkTab">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <attribute name="title">
+          <string>Link</string>
+         </attribute>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="vvLinkPanel" name="linkPanel" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="Landmarkstab">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <attribute name="title">
+          <string>Landmarks</string>
+         </attribute>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="vvLandmarksPanel" name="landmarksPanel" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </widget>
+       <widget class="vvInfoPanel" name="infoPanel" native="true">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+       </widget>
+      </widget>
+      <widget class="QSplitter" name="splitter_3">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+         <horstretch>1</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <widget class="QSplitter" name="OSplitter">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <widget class="QWidget" name="NOWidget" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <layout class="QGridLayout">
+          <property name="horizontalSpacing">
+           <number>2</number>
+          </property>
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QVTKWidget" name="NOViewWidget" native="true">
+            <property name="mouseTracking">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QSlider" name="NOVerticalSlider">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QSlider" name="NOHorizontalSlider">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="SOWidget" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QVTKWidget" name="SOViewWidget" native="true">
+            <property name="mouseTracking">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QSlider" name="SOVerticalSlider">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QSlider" name="SOHorizontalSlider">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </widget>
+       <widget class="QSplitter" name="ESplitter">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <widget class="QWidget" name="NEWidget" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QVTKWidget" name="NEViewWidget" native="true">
+            <property name="mouseTracking">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QSlider" name="NEVerticalSlider">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QSlider" name="NEHorizontalSlider">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="SEWidget" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <layout class="QGridLayout">
+          <property name="margin">
+           <number>2</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QVTKWidget" name="SEViewWidget" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="mouseTracking">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QSlider" name="SEVerticalSlider">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QSlider" name="SEHorizontalSlider">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </widget>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1008</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="defaultUp">
+    <bool>false</bool>
+   </property>
+   <widget class="QMenu" name="menuHelp">
+    <property name="title">
+     <string>Help</string>
+    </property>
+    <addaction name="actionNavigation_Help"/>
+    <addaction name="actionDocumentation"/>
+    <addaction name="actionRegister_vv"/>
+   </widget>
+   <widget class="QMenu" name="menuOverlay">
+    <property name="title">
+     <string>Overlay</string>
+    </property>
+    <addaction name="actionAdd_VF_to_current_Image"/>
+    <addaction name="actionAdd_overlay_image_to_current_image"/>
+    <addaction name="actionAdd_fusion_image"/>
+    <addaction name="actionAdd_USSequence_toCT"/>
+   </widget>
+   <widget class="QMenu" name="menuScreenshots">
+    <property name="title">
+     <string>Screenshots</string>
+    </property>
+    <addaction name="actionNorth_West_Window"/>
+    <addaction name="actionNorth_East_Window"/>
+    <addaction name="actionSouth_West_Window"/>
+    <addaction name="actionSouth_East_Window"/>
+    <addaction name="separator"/>
+    <addaction name="actionSave_all_slices"/>
+   </widget>
+   <widget class="QMenu" name="menuExperimental">
+    <property name="title">
+     <string>Experimental</string>
+    </property>
+    <addaction name="actionSurface_Viewer"/>
+    <addaction name="actionDeformable_Registration"/>
+    <addaction name="actionSegmentation"/>
+    <addaction name="actionWarp_image_with_vector_field"/>
+    <addaction name="actionCompute_mid_position_image"/>
+   </widget>
+   <widget class="QMenu" name="menuTools">
+    <property name="title">
+     <string>Tools</string>
+    </property>
+   </widget>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>File</string>
+    </property>
+    <addaction name="actionLoad_images"/>
+    <addaction name="actionOpen_Image_With_Time"/>
+    <addaction name="actionMerge_images_as_n_dim_t"/>
+    <addaction name="separator"/>
+    <addaction name="actionSlice_Image_As_Multiple_Images"/>
+    <addaction name="actionOpen_Multiple_Images_As_One"/>
+    <addaction name="separator"/>
+    <addaction name="actionOpen_Dicom"/>
+    <addaction name="actionOpen_VTK_contour"/>
+    <addaction name="actionConnect_Pacs"/>
+    <addaction name="separator"/>
+    <addaction name="actionSave_As"/>
+    <addaction name="separator"/>
+    <addaction name="actionRead_saved_state"/>
+    <addaction name="actionSave_current_state"/>
+    <addaction name="separator"/>
+    <addaction name="actionExit"/>
+    <addaction name="separator"/>
+    <addaction name="separator"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menuOverlay"/>
+   <addaction name="menuScreenshots"/>
+   <addaction name="menuTools"/>
+   <addaction name="menuExperimental"/>
+   <addaction name="menuHelp"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionLoad_images">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/fileopen.png</normaloff>:/common/icons/fileopen.png</iconset>
+   </property>
+   <property name="text">
+    <string>Open image(s)</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionClose_image">
+   <property name="text">
+    <string>Close images</string>
+   </property>
+  </action>
+  <action name="actionExit">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/exit.png</normaloff>:/common/icons/exit.png</iconset>
+   </property>
+   <property name="text">
+    <string>Exit</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionSave_screenshot">
+   <property name="text">
+    <string>Save screenshot</string>
+   </property>
+  </action>
+  <action name="actionPickable">
+   <property name="text">
+    <string>pickable</string>
+   </property>
+  </action>
+  <action name="actionDragable">
+   <property name="text">
+    <string>dragable</string>
+   </property>
+  </action>
+  <action name="actionSet_colormap">
+   <property name="text">
+    <string>Set colormap</string>
+   </property>
+  </action>
+  <action name="actionIsoContours">
+   <property name="text">
+    <string>IsoContours</string>
+   </property>
+  </action>
+  <action name="actionAbouts">
+   <property name="text">
+    <string>About QtVTKRender2D</string>
+   </property>
+  </action>
+  <action name="actionDocumentation">
+   <property name="text">
+    <string>About</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionReload_images">
+   <property name="text">
+    <string>Reload images</string>
+   </property>
+  </action>
+  <action name="actionOpen_Dicom">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Open Dicom</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionOpen_Multiple_Images_As_One">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Merge several nD images into a single (n+1)D image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionSlice_Image_As_Multiple_Images">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Slice a nD image into several (n-1)D images</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionOpen_one_Image_as_Multiple">
+   <property name="text">
+    <string>Open One Image As Multiple</string>
+   </property>
+  </action>
+  <action name="actionSave_As">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/filesave.png</normaloff>:/common/icons/filesave.png</iconset>
+   </property>
+   <property name="text">
+    <string>Save current image</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+S</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionAdd_VF_to_current_Image">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/cursor-uparrow.png</normaloff>:/common/icons/cursor-uparrow.png</iconset>
+   </property>
+   <property name="text">
+    <string>Add deformation field to current image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionNorth_West_Window">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/NOgrid.png</normaloff>:/common/icons/NOgrid.png</iconset>
+   </property>
+   <property name="text">
+    <string>Save image in TL</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionNorth_East_Window">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/NEgrid.png</normaloff>:/common/icons/NEgrid.png</iconset>
+   </property>
+   <property name="text">
+    <string>Save image in TR</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionSouth_West_Window">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/SOgrid.png</normaloff>:/common/icons/SOgrid.png</iconset>
+   </property>
+   <property name="text">
+    <string>Save image in BL</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionSouth_East_Window">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/SEgrid.png</normaloff>:/common/icons/SEgrid.png</iconset>
+   </property>
+   <property name="text">
+    <string>Save image in BR</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionOpen_Image_With_Time">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Open a nD image as a (n-1)D + t image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionMerge_images_as_n_dim_t">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Open several nD images into a single nD+t image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionAdd_fusion_image">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/fusion.png</normaloff>:/common/icons/fusion.png</iconset>
+   </property>
+   <property name="text">
+    <string>Add fusion image to current image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionSegmentation">
+   <property name="text">
+    <string>Segmentation</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionResampler">
+   <property name="text">
+    <string>Resample</string>
+   </property>
+  </action>
+  <action name="actionSurface_Viewer">
+   <property name="text">
+    <string>Surface Viewer</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionDebug">
+   <property name="text">
+    <string>joelDebug</string>
+   </property>
+  </action>
+  <action name="actionDeformable_Registration">
+   <property name="text">
+    <string>Deformable Registration</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionWarp_image_with_vector_field">
+   <property name="text">
+    <string>Verify Registration</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionMaximum_Intensity_Projection">
+   <property name="text">
+    <string>Maximum Intensity Projection</string>
+   </property>
+  </action>
+  <action name="actionOpen_VTK_contour">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Open VTK or OBJ contour</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionNavigation_Help">
+   <property name="text">
+    <string>Navigation Help</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+   <property name="priority">
+    <enum>QAction::NormalPriority</enum>
+   </property>
+  </action>
+  <action name="actionOpen_Dicom_Struct">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Open Dicom-Struct</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionCompute_mid_position_image">
+   <property name="text">
+    <string>Compute mid-position image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionExperimental">
+   <property name="text">
+    <string>Experimental...</string>
+   </property>
+  </action>
+  <action name="actionRegister_vv">
+   <property name="text">
+    <string>Register vv</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionSave_all_slices">
+   <property name="text">
+    <string>Save all slices (Top-Left view)</string>
+   </property>
+  </action>
+  <action name="actionSave_current_state">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/filesave.png</normaloff>:/common/icons/filesave.png</iconset>
+   </property>
+   <property name="text">
+    <string>Save current state</string>
+   </property>
+   <property name="toolTip">
+    <string>Save current window and file states</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionRead_saved_state">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/open.png</normaloff>:/common/icons/open.png</iconset>
+   </property>
+   <property name="text">
+    <string>Read Saved State</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionAdd_overlay_image_to_current_image">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/GPSup.png</normaloff>:/common/icons/GPSup.png</iconset>
+   </property>
+   <property name="text">
+    <string>Add overlay image to current image</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionAdd_USSequence_toCT">
+   <property name="icon">
+    <iconset resource="../vvIcons.qrc">
+     <normaloff>:/common/icons/rotateright.png</normaloff>:/common/icons/rotateright.png</iconset>
+   </property>
+   <property name="text">
+    <string>Test / Fusion of US &amp; CT sequences</string>
+   </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
+  </action>
+  <action name="actionConnect_Pacs">
+   <property name="text">
+    <string>Connect Pacs</string>
+   </property>
+  </action>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header>QVTKWidget.h</header>
+  </customwidget>
+  <customwidget>
+   <class>vvInfoPanel</class>
+   <extends>QWidget</extends>
+   <header>vvInfoPanel.h</header>
+  </customwidget>
+  <customwidget>
+   <class>vvLandmarksPanel</class>
+   <extends>QWidget</extends>
+   <header>vvLandmarksPanel.h</header>
+  </customwidget>
+  <customwidget>
+   <class>vvLinkPanel</class>
+   <extends>QWidget</extends>
+   <header>vvLinkPanel.h</header>
+  </customwidget>
+  <customwidget>
+   <class>vvOverlayPanel</class>
+   <extends>QWidget</extends>
+   <header>vvOverlayPanel.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>presetComboBox</tabstop>
+  <tabstop>windowSpinBox</tabstop>
+  <tabstop>levelSpinBox</tabstop>
+  <tabstop>NOViewWidget</tabstop>
+  <tabstop>NOVerticalSlider</tabstop>
+  <tabstop>NOHorizontalSlider</tabstop>
+  <tabstop>SOVerticalSlider</tabstop>
+  <tabstop>SOHorizontalSlider</tabstop>
+  <tabstop>NEVerticalSlider</tabstop>
+  <tabstop>NEHorizontalSlider</tabstop>
+  <tabstop>SEVerticalSlider</tabstop>
+  <tabstop>SEHorizontalSlider</tabstop>
+  <tabstop>viewButton</tabstop>
+ </tabstops>
+ <resources>
+  <include location="../vvIcons.qrc"/>
+ </resources>
+ <connections/>
+</ui>
index 476762524d60f0cbb6b80c294f56dae2ee93e8b4..d7e930918797607c5ee71c043e065b96c381b89b 100644 (file)
@@ -28,7 +28,7 @@
     </widget>
    </item>
    <item rowspan="4" row="0" column="2" colspan="6" >
-    <widget class="QVTKWidget" name="viewWidget" />
+    <widget class="QVTKOpenGLNativeWidget" name="viewWidget" />
    </item>
    <item row="1" column="0" >
     <widget class="QLabel" name="minLabel" >
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QVTKWidget</class>
+   <class>QVTKOpenGLNativeWidget</class>
    <extends>QWidget</extends>
-   <header>QVTKWidget.h</header>
+   <header>QVTKOpenGLNativeWidget.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
diff --git a/vv/qt_ui/vvSegmentationDialogVTK7.ui b/vv/qt_ui/vvSegmentationDialogVTK7.ui
new file mode 100644 (file)
index 0000000..4767625
--- /dev/null
@@ -0,0 +1,159 @@
+<ui version="4.0" >
+ <class>vvSegmentationDialog</class>
+ <widget class="QDialog" name="vvSegmentationDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>561</width>
+    <height>453</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Segmentation tool</string>
+  </property>
+  <layout class="QGridLayout" >
+   <item row="0" column="0" >
+    <widget class="QSlider" name="clipping1Slider" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1" >
+    <widget class="QSlider" name="clipping2Slider" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+   </item>
+   <item rowspan="4" row="0" column="2" colspan="6" >
+    <widget class="QVTKWidget" name="viewWidget" />
+   </item>
+   <item row="1" column="0" >
+    <widget class="QLabel" name="minLabel" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>Min :</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="2" >
+    <widget class="QLabel" name="maxLabel" >
+     <property name="text" >
+      <string>Max :</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="2" >
+    <widget class="QPushButton" name="binaryButton" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>Binarise</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0" colspan="2" >
+    <widget class="QPushButton" name="erodeButton" >
+     <property name="text" >
+      <string>Erode</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="2" >
+    <widget class="QPushButton" name="dilateButton" >
+     <property name="text" >
+      <string>Dilate</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="3" >
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string>Kernel Size :</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="4" >
+    <widget class="QSpinBox" name="kernelSpinBox" >
+     <property name="minimum" >
+      <number>1</number>
+     </property>
+     <property name="value" >
+      <number>2</number>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="5" >
+    <widget class="QPushButton" name="dimButton" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>3D</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="6" >
+    <widget class="QPushButton" name="saveButton" >
+     <property name="text" >
+      <string>Save As</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="7" >
+    <widget class="QPushButton" name="closeButton" >
+     <property name="text" >
+      <string>Close</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0" colspan="5" >
+    <widget class="QLabel" name="infoLabel" >
+     <property name="text" >
+      <string>TextLabel</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header>QVTKWidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>closeButton</sender>
+   <signal>clicked()</signal>
+   <receiver>vvSegmentationDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>528</x>
+     <y>403</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>542</x>
+     <y>423</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 6683830f664dc420190788ff1b1fb0dc9313a7cb..a87d8ff77923db76bc27621d10da50c884216cf0 100644 (file)
@@ -14,7 +14,7 @@
   </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" colspan="3" >
-    <widget class="QVTKWidget" name="renderWidget" />
+    <widget class="QVTKOpenGLNativeWidget" name="renderWidget" />
    </item>
    <item row="1" column="0" >
     <spacer>
@@ -47,9 +47,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QVTKWidget</class>
+   <class>QVTKOpenGLNativeWidget</class>
    <extends>QWidget</extends>
-   <header>QVTKWidget.h</header>
+   <header>QVTKOpenGLNativeWidget.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
diff --git a/vv/qt_ui/vvSurfaceViewerDialogVTK7.ui b/vv/qt_ui/vvSurfaceViewerDialogVTK7.ui
new file mode 100644 (file)
index 0000000..6683830
--- /dev/null
@@ -0,0 +1,74 @@
+<ui version="4.0" >
+ <class>vvSurfaceViewerDialog</class>
+ <widget class="QDialog" name="vvSurfaceViewerDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>554</width>
+    <height>472</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Dialog</string>
+  </property>
+  <layout class="QGridLayout" >
+   <item row="0" column="0" colspan="3" >
+    <widget class="QVTKWidget" name="renderWidget" />
+   </item>
+   <item row="1" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>311</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QPushButton" name="loadButton" >
+     <property name="text" >
+      <string>Load</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="2" >
+    <widget class="QPushButton" name="closeButton" >
+     <property name="text" >
+      <string>Close</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header>QVTKWidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>closeButton</sender>
+   <signal>clicked()</signal>
+   <receiver>vvSurfaceViewerDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>492</x>
+     <y>436</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>443</x>
+     <y>435</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 01851e08d32290f3299f1f98e5bc5f2e4d2a9685..7cc94e9179b95785cb23403bcc623a07bbe247c1 100644 (file)
@@ -78,7 +78,7 @@
       </widget>
      </item>
      <item>
-      <widget class="QVTKWidget" name="HistogramWidget" native="true">
+      <widget class="QVTKOpenGLNativeWidget" name="HistogramWidget" native="true">
        <property name="minimumSize">
         <size>
          <width>0</width>
@@ -96,9 +96,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QVTKWidget</class>
+   <class>QVTKOpenGLNativeWidget</class>
    <extends>QWidget</extends>
-   <header>QVTKWidget.h</header>
+   <header>QVTKOpenGLNativeWidget.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
diff --git a/vv/qt_ui/vvToolHistogramVTK7.ui b/vv/qt_ui/vvToolHistogramVTK7.ui
new file mode 100644 (file)
index 0000000..01851e0
--- /dev/null
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolHistogram</class>
+ <widget class="QWidget" name="vvToolHistogram">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>506</width>
+    <height>452</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Histogram image</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_3">
+     <item>
+      <layout class="QGridLayout" name="gridLayout_2">
+       <property name="horizontalSpacing">
+        <number>6</number>
+       </property>
+       <item row="2" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout_6">
+         <item>
+          <widget class="QPushButton" name="mSaveHistogramButton">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Save Histogram</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="mPosPoint2Label">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>200</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="1">
+        <layout class="QHBoxLayout" name="horizontalLayout_3"/>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <widget class="Line" name="line_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QVTKWidget" name="HistogramWidget" native="true">
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>300</height>
+        </size>
+       </property>
+       <property name="mouseTracking">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header>QVTKWidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
index bc3c9c85d15c05a12d40e7d4fa2ffcebeb2daab3..fb0b5ad6f0ee834c357fffb8efa3249c701c7f54 100644 (file)
       </widget>
      </item>
      <item>
-      <widget class="QVTKWidget" name="ProfileWidget" native="true">
+      <widget class="QVTKOpenGLNativeWidget" name="ProfileWidget" native="true">
        <property name="minimumSize">
         <size>
          <width>0</width>
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QVTKWidget</class>
+   <class>QVTKOpenGLNativeWidget</class>
    <extends>QWidget</extends>
-   <header>QVTKWidget.h</header>
+   <header>QVTKOpenGLNativeWidget.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
diff --git a/vv/qt_ui/vvToolProfileVTK7.ui b/vv/qt_ui/vvToolProfileVTK7.ui
new file mode 100644 (file)
index 0000000..bc3c9c8
--- /dev/null
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolProfile</class>
+ <widget class="QWidget" name="vvToolProfile">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>505</width>
+    <height>452</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Profile image</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_3">
+     <item>
+      <layout class="QGridLayout" name="gridLayout_2">
+       <property name="horizontalSpacing">
+        <number>6</number>
+       </property>
+       <item row="2" column="1">
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QPushButton" name="mSelectPoint2Button">
+           <property name="text">
+            <string>Select point 2</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="Point2">
+           <property name="text">
+            <string>Center of voxel2 (vox):</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="2" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="mPosPoint2Label">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>200</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="3" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout_6">
+         <item>
+          <widget class="QToolButton" name="mCancelPointsButton">
+           <property name="text">
+            <string>Cancel</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mSaveProfileButton">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Save Profile</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="1">
+        <layout class="QHBoxLayout" name="horizontalLayout_7">
+         <item>
+          <widget class="QPushButton" name="mSelectPoint1Button">
+           <property name="text">
+            <string>Select point 1</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="Point1">
+           <property name="text">
+            <string>Center of voxel1 (vox):</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="3">
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QLabel" name="mPosPoint1Label">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>200</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <widget class="Line" name="line_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QVTKWidget" name="ProfileWidget" native="true">
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>300</height>
+        </size>
+       </property>
+       <property name="mouseTracking">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header>QVTKWidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
index e88a5d9695b961b8a410467d4d1f1de783c21adf..1bf54692df4a6de78ae15e312f2d3786f9098249 100644 (file)
@@ -18,6 +18,7 @@ It is distributed under dual licence
 
 #include <algorithm>
 #include <QMessageBox>
+#include <QMimeData>
 #include <QInputDialog>
 #include <QTimer>
 #include "QTreePushButton.h"
@@ -132,6 +133,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
 { 
   setupUi(this); // this sets up the GUI
 
+  setAcceptDrops(true); // enable to drop into the window
+
   setDicomClient();
 
   //Qt::WindowFlags flags = windowFlags();
@@ -816,6 +819,25 @@ void vvMainWindow::OpenRecentImage()
   LoadImages(images, vvImageReader::IMAGE);
 }
 //------------------------------------------------------------------------------
+void vvMainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+  if (event->mimeData()->hasUrls()) {
+    event->acceptProposedAction();
+  }
+}
+//------------------------------------------------------------------------------
+void vvMainWindow::dropEvent(QDropEvent *event)
+{
+  const QMimeData * mimeData = event->mimeData();
+  if (!mimeData->hasUrls())
+    return;
+  std::vector<std::string> images;
+  for (int i=0; i<mimeData->urls().size(); ++i) {
+    images.push_back(mimeData->urls()[i].toLocalFile().toStdString());
+  }
+  LoadImages(images, vvImageReader::IMAGE);
+}
+//------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
@@ -3278,7 +3300,11 @@ void vvMainWindow::SaveSEScreenshot()
 //------------------------------------------------------------------------------
 void vvMainWindow::SaveScreenshotAllSlices()
 { 
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
+  QVTKOpenGLNativeWidget *widget = NOViewWidget;
+#else
   QVTKWidget *widget = NOViewWidget;
+#endif
 
   int index = 0;// GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   vvSlicerManager * SM = mSlicerManagers[index];
@@ -3304,7 +3330,7 @@ void vvMainWindow::SaveScreenshotAllSlices()
     // Screenshot
     vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter = vtkSmartPointer<vtkWindowToImageFilter>::New();
     windowToImageFilter->SetInput(renderWindow);
-#if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1
+#if (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
     windowToImageFilter->SetScale(1);
 #else
     windowToImageFilter->SetMagnification(1);
@@ -3334,7 +3360,11 @@ void vvMainWindow::SaveScreenshotAllSlices()
 
 
 //------------------------------------------------------------------------------
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
+void vvMainWindow::SaveScreenshot(QVTKOpenGLNativeWidget *widget)
+#else
 void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
+#endif
 { 
   QString Extensions = "Images( *.png);;";
   Extensions += "Images( *.jpg);;";
@@ -3358,7 +3388,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
   if (!fileName.isEmpty()) {
     vtkSmartPointer<vtkWindowToImageFilter> w2i = vtkSmartPointer<vtkWindowToImageFilter>::New();
     w2i->SetInput(widget->GetRenderWindow());
-#if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1
+#if (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
     w2i->SetScale(1);
 #else
     w2i->SetMagnification(1);
index 8908b24004ca7fca8bae8c6f0e3d76fa5f9968a1..07f38e5f9f415613c68410f8eb35445a504203b8 100644 (file)
 
 #include <iostream>
 #include <vector>
+#include <QDropEvent>
+#include "vtkVersion.h"
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
 #include "ui_vvMainWindow.h"
+#else
+#include "ui_vvMainWindowVTK7.h"
+#endif
 #include "vvMainWindowBase.h"
 #include "vvToolManager.h"
 #include "vvImageReader.h"
@@ -192,6 +198,10 @@ protected:
   void createRecentlyOpenedFilesMenu();
   void updateRecentlyOpenedFilesMenu(const std::list<std::string> &files);
   
+  // Drag and drop event handlers
+  virtual void dragEnterEvent(QDragEnterEvent *event);
+  virtual void dropEvent(QDropEvent *event);
+
 private:
 
   //variables
@@ -222,7 +232,11 @@ private:
   QString GetVectorIntAsString(std::vector<int> vectorInt);
   int GetSlicerIndexFromItem(QTreeWidgetItem* item); //this actually returns the SlicerManager index TODO: rename it to GetSlicerManagerIndexFromItem
   QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
+  void SaveScreenshot(QVTKOpenGLNativeWidget *widget);
+#else
   void SaveScreenshot(QVTKWidget *widget);
+#endif
   int GetImageDuplicateFilenameNumber(std::string filename);
 
   QMenu contextMenu;
index 0feabf3fac5dc8123b5c12b4f468ebf2c97432bd..b04163853d202f14f1a435f89b50c9444f38a036 100644 (file)
@@ -24,7 +24,7 @@
 
 // gdcm 
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include <gdcmReader.h>
 #include <gdcmTag.h>
 #include <gdcmAttribute.h>
@@ -125,7 +125,7 @@ std::vector<std::pair<int,std::string> > vvMeshReader::GetROINames()
   }
 
 #else
-#if GDCM_MAJOR_VERSION == 2 
+#if GDCM_MAJOR_VERSION >= 2
 
     // duplicate code from  clitk::DicomRT_StructureSet::Read
     gdcm::Reader * reader = new gdcm::Reader;
@@ -223,7 +223,7 @@ std::vector<std::pair<int,std::string> > vvMeshReader::GetROINames()
 std::vector<vvMesh::Pointer> vvMeshReader::readSelectedContours()
 {
   std::vector<vvMesh::Pointer> result;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Reader reader;
   reader.SetFileName(filename.c_str());
   reader.Read();
index 2a77e8dcaff5a5a335c23f4366571dfb238691e2..165104f068b3b6bc085965317f4045af61a8f8a0 100644 (file)
@@ -250,7 +250,7 @@ void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
 {
   QString fusionValue = "<b>Pixel value in image 2 : </b>";
   if (visibility) {
-    fusionValue += QString::number(value,'f',1);
+    fusionValue += QString::number(value,'g',3);
   }
   valueFusionnedLabel->setText(fusionValue);
 }
index 9c279827128062caf963b9207ff8d247ced02664..d5444cdbe5b168317880b97895b8f741f7379045 100644 (file)
@@ -20,7 +20,7 @@
 #include <itkGDCMImageIO.h>
 #include <itkGDCMSeriesFileNames.h>
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include <gdcmImageReader.h>
 #include <gdcmDataSetHelper.h>
 #include <gdcmStringFilter.h>
@@ -144,7 +144,7 @@ void vvDicomSeriesSelector::SearchButtonRelease()
       mListOfSeriesFilenames[seriesUID[i]] = filenames;
 
       // store first header
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
       mDicomHeader[seriesUID[i]].SetFileName( (*filenames)[0].c_str() );
       mDicomHeader[seriesUID[i]].Read();
 #else
@@ -235,7 +235,7 @@ void vvDicomSeriesSelector::itemDetailsSelectionChanged()
       std::ostringstream s;
       QString l;
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
       mDicomHeader[mCurrentSerie].GetFile().Print(s);
       const gdcm::File& header = mDicomHeader[mCurrentSerie].GetFile();
       gdcm::StringFilter sf;
@@ -284,7 +284,7 @@ void vvDicomSeriesSelector::itemDetailsSelectionChanged()
 //====================================================================
 
 //====================================================================
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, const gdcm::Reader& header)
 {
   QString n = QString("%1").arg(mListOfSeriesFilenames[s]->size());
@@ -357,7 +357,7 @@ QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, gdcm::File *header
 //====================================================================
 QString vvDicomSeriesSelector::AddInfo(const gdcm::File *header, QString n, uint16_t group, uint16_t elem)
 {
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::StringFilter sf;
   sf.SetFile( *header );
   gdcm::Tag t( group, elem );
@@ -381,7 +381,7 @@ QString vvDicomSeriesSelector::AddInfo(std::string n, std::string m)
 //====================================================================
 void vvDicomSeriesSelector::AddSerieToTheTable(int i, std::vector<std::string> & filenames)
 {
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #else
   gdcm::File *header = new gdcm::File();
   header->SetFileName(filenames[0]);
index aa905fcfead1932b43474dd4afd732dc1f74a729..b70e507ee233b923333243d895eac1551cbee9e0 100644 (file)
@@ -50,7 +50,7 @@ protected:
     QString mPreviousPath;
     QString mFoldername;
     void AddSerieToTheTable(int i, std::vector<std::string> & filenames);
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     QString MakeDicomInfo(std::string & s, const gdcm::Reader& header);
 #else
     QString MakeDicomInfo(std::string & s, gdcm::File *header);
@@ -64,7 +64,7 @@ private:
     std::map<std::string, std::vector<std::string>* > mListOfSeriesFilenames;
     std::vector<std::string> * mFilenames;
     std::map<std::string, QString> mDicomInfo;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     std::map<std::string, gdcm::Reader> mDicomHeader;
 #else
     std::map<std::string, gdcm::File*> mDicomHeader;
index f457df5ee6e7e4864bd4a9e04843330af9ad1a42..d359e5d2e2190b6603f7fd0d5b633ed854cdc6f0 100644 (file)
 ===========================================================================**/
 #ifndef _VVSEGMENTATIONDIALOG_H
 #define _VVSEGMENTATIONDIALOG_H
+#include <vtkVersion.h>
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
 #include "ui_vvSegmentationDialog.h"
+#else
+#include "ui_vvSegmentationDialogVTK7.h"
+#endif
 #include "clitkCommon.h"
 #include "vvImage.h"
 #include "vvSlicerManager.h"
index a53daf24da6eda141db18747f319af5fb0d452cd..7405a450bb67f3e35f23aedfbd39abba34cfa8cf 100644 (file)
@@ -653,7 +653,9 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
 #else
     mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
 #endif
+#ifndef VTK_OPENGL2
     mVFMapper->ImmediateModeRenderingOn();
+#endif
     mVFMapper->SetLookupTable(mVFColorLUT);
 
     if (!mVFActor)
index f53c9bb5ba0fdb0a93e02782e4c21a2960c38004..c0a8840f2f20a4b1470c8dc48ef52123e5a996ba 100644 (file)
 ===========================================================================**/
 #ifndef _vvSurfaceViewerDialog_H
 #define _vvSurfaceViewerDialog_H
+#include <vtkVersion.h>
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
 #include "ui_vvSurfaceViewerDialog.h"
+#else
+#include "ui_vvSurfaceViewerDialogVTK7.h"
+#endif
 
 class vtkPolyDataMapper;
 class vtkActor;
index 293fbcde3991f30e91ba1c547e4b52e8099b2cec..939642ab4e7c527476db0e5221d7f45860027e68 100644 (file)
@@ -311,7 +311,11 @@ void vvToolHistogram::InputIsSelected(vvSlicerManager * m)
 
 
 //------------------------------------------------------------------------------
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
+QVTKOpenGLNativeWidget* vvToolHistogram::GetHistogramWidget()
+#else
 QVTKWidget* vvToolHistogram::GetHistogramWidget()
+#endif
 {
   return(HistogramWidget);
 }
index 437e4e6e04ef5ba9bf7ea7ef6fef5cf941e9a82b..3897c902168a26d9153fae723028dd2f15ac87a7 100644 (file)
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
+#include <vtkVersion.h>
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
 #include "ui_vvToolHistogram.h"
+#else
+#include "ui_vvToolHistogramVTK7.h"
+#endif
 
 #include "clitkHistogramImage_ggo.h"
 #include "clitkHistogramImageGenericFilter.h"
@@ -61,7 +66,11 @@ class vvToolHistogram:
 
   void displayHistogram();
 
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
+  QVTKOpenGLNativeWidget* GetHistogramWidget();
+#else
   QVTKWidget* GetHistogramWidget();
+#endif
 
   //-----------------------------------------------------
   public slots:
index 0410637f396b79a1f08faad0502c97b0918aef7e..0f94ff3a9177c52b81afa0e25eaedfc865d2ea3c 100644 (file)
 #include "vvToolWidgetBase.h"
 #include "vvImageContour.h"
 #include "vvLandmarks.h"
+#include <vtkVersion.h>
+#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9
 #include "ui_vvToolProfile.h"
+#else
+#include "ui_vvToolProfileVTK7.h"
+#endif
 #include "vvBinaryImageOverlayActor.h"
 
 #include "clitkProfileImage_ggo.h"