]> Creatis software - clitk.git/commitdiff
Merge branch 'master' into clitkImage2Dicom
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 15 May 2017 09:48:45 +0000 (11:48 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 15 May 2017 09:48:45 +0000 (11:48 +0200)
127 files changed:
.travis.yml
README.md
cluster_tools/CMakeLists.txt
cluster_tools/gate_job_ccin2p3.job
cluster_tools/gate_run_submit_cluster.sh
cmake/build_opt.cmake
cmake/dependencies.cmake
common/clitkCommon.h
common/clitkDicomRTDoseIO.h
common/clitkDicomRTDoseIOFactory.h
common/clitkEsrfHstImageIO.h
common/clitkEsrfHstImageIOFactory.h
common/clitkEsrfHstXMLFileReader.h
common/clitkGateAsciiImageIO.h
common/clitkGateAsciiImageIOFactory.h
common/clitkMemoryUsage.cxx
common/clitkVfImageIO.h
common/clitkVfImageIOFactory.h
common/clitkVoxImageIO.h
common/clitkVoxImageIOFactory.h
common/clitkXdrImageIO.h
common/clitkXdrImageIOFactory.h
common/rtkEdfImageIO.h
common/rtkEdfImageIOFactory.h
common/rtkHisImageIO.h
common/rtkHisImageIOFactory.h
common/rtkHndImageIO.h
common/rtkHndImageIOFactory.h
common/rtkImagXImageIO.h
common/rtkImagXImageIOFactory.h
common/rtkImagXXMLFileReader.h
common/rtkXRadImageIO.h
common/rtkXRadImageIOFactory.h
common/vvImage.cxx
common/vvImageReader.txx
itk/RelativePositionPropImageFilter.h
itk/clitkAddRelativePositionConstraintToLabelImageFilter.h
itk/clitkAutoCropFilter.h
itk/clitkBooleanOperatorLabelImageFilter.h
itk/clitkCropLikeImageFilter.h
itk/clitkExplosionControlledThresholdConnectedImageFilter.h
itk/clitkExtractSliceFilter.h
itk/clitkInvertVFFilter.h
itk/clitkInvertVFFilter.txx
itk/clitkLocallyAdaptiveBinaryThresholdImageFunction.h
itk/clitkLocallyAdaptiveThresholdConnectedImageFilter.h
itk/clitkPasteImageFilter.h
itk/clitkResampleImageWithOptionsFilter.h
itk/clitkSetBackgroundImageFilter.h
itk/clitkSliceBySliceRelativePositionFilter.h
itk/itkBSplineInterpolateImageFunctionWithLUT.h
itk/itkFlexibleBinaryFunctorImageFilter.h
registration/clitkAffineRegistrationGenericFilter.cxx
registration/clitkConvertBLUTCoeffsToVFFilter.h
registration/clitkConvertBLUTCoeffsToVFFilter.txx
registration/clitkCorrelationRatioImageToImageMetric.h
registration/clitkLBFGSBOptimizer.h
registration/clitkOptNormalizedCorrelationImageToImageMetric.h
registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h
registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h
superbuild/CMakeLists.txt
tools/CMakeLists.txt
tools/clitk4DImageToNVectorImageGenericFilter.txx
tools/clitkHistogramImage.cxx [new file with mode: 0644]
tools/clitkHistogramImage.ggo [new file with mode: 0644]
tools/clitkHistogramImageGenericFilter.cxx [new file with mode: 0644]
tools/clitkHistogramImageGenericFilter.h [new file with mode: 0644]
tools/clitkImageConvert.cxx
tools/clitkImageConvert.ggo
tools/clitkImageConvertGenericFilter.cxx
tools/clitkImageConvertGenericFilter.h
tools/clitkImageCreate.cxx
tools/clitkImageCreate.ggo
tools/clitkNVectorImageTo4DImageGenericFilter.txx
tools/clitkProfileImage.ggo
tools/clitkProfileImageGenericFilter.cxx
tools/clitkProfileImageGenericFilter.h
tools/clitkSplitImageGenericFilter.cxx
tools/clitkWarpImageGenericFilter.txx
travis/travis_build_itk.sh
travis/travis_build_qt.sh
travis/travis_build_vtk.sh
travis/travis_build_vv.sh
vv/CMakeLists.txt
vv/icons/histogram.png [new file with mode: 0644]
vv/qt_ui/vvInfoPanel.ui
vv/qt_ui/vvMainWindow.ui
vv/qt_ui/vvToolHistogram.ui [new file with mode: 0644]
vv/vvIcons.qrc
vv/vvIntensityValueSlider.h
vv/vvLabelImageLoaderWidget.h
vv/vvMainWindow.cxx
vv/vvQProgressDialogITKCommand.h
vv/vvReadState.h
vv/vvSaveState.h
vv/vvSegmentationDialog.h
vv/vvSlicer.cxx
vv/vvSlicer.h
vv/vvSurfaceViewerDialog.h
vv/vvToolBaseBase.cxx
vv/vvToolBaseBase.h
vv/vvToolBinarize.h
vv/vvToolCreatorBase.h
vv/vvToolCropImage.cxx
vv/vvToolCropImage.h
vv/vvToolFoo.h
vv/vvToolFooWithWidgetBase.h
vv/vvToolHistogram.cxx [new file with mode: 0644]
vv/vvToolHistogram.h [new file with mode: 0644]
vv/vvToolHistogramCommand.cxx [new file with mode: 0644]
vv/vvToolHistogramCommand.h [new file with mode: 0644]
vv/vvToolImageArithm.h
vv/vvToolInputSelectorWidget.h
vv/vvToolMIP.h
vv/vvToolMedianFilter.h
vv/vvToolPlastimatch.h
vv/vvToolProfile.cxx
vv/vvToolProfile.h
vv/vvToolROIManager.cxx
vv/vvToolROIManager.h
vv/vvToolResample.h
vv/vvToolRigidReg.cxx
vv/vvToolSegmentation.h
vv/vvToolSimpleInputSelectorWidget.h
vv/vvToolStructureSetManager.h
vv/vvToolWidgetBase.h

index 43121daaaa0db0ed2a643632919ceff961416c2c..e7bb44e67fa1fb6d5052257b1577077a273996f2 100644 (file)
@@ -12,16 +12,33 @@ compiler:
     - gcc
     - clang
 env:
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=5.5.1
-    - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=5.5.1
-    - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7
-    - WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.5 QT_VERSION=4.8.7
+    - 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.5 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=5.10 ITK_VERSION=4.5 QT_VERSION=4.8.7 C11=true
 
 matrix:
   exclude:
   - os: osx
-    env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.5 QT_VERSION=4.8.7 #VTK6.0 doesn't work with osX
+    env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.5 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.5 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: linux
+    env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.5 QT_VERSION=4.8.7 C11=true #Problem with VTK 5.10 and c++11
 
 language: cpp
 
@@ -30,6 +47,10 @@ notifications:
   on_success: never
   on_failure: never
 
+branches:
+only:
+- master
+
 before_install:
 - if test $TRAVIS_OS_NAME == osx ; then brew update; fi
 - if test $TRAVIS_OS_NAME == linux ; then sudo add-apt-repository --yes ppa:kubuntu-ppa/backports; fi
@@ -52,8 +73,10 @@ install:
 - 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 == osx ; then export HOMEBREW_QT_VERSION=$(brew list --versions qt | rev | cut -d' ' -f1 | rev); fi
-- if test $TRAVIS_OS_NAME == osx ; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then ln -s /usr/local/Cellar/qt@5.5/5.5.1/mkspecs /usr/local/mkspecs; fi; fi
-- if test $TRAVIS_OS_NAME == osx ; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then ln -s /usr/local/Cellar/qt@5.5/5.5.1/plugins /usr/local/plugins; fi; fi
+- if test $TRAVIS_OS_NAME == osx ; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then ln -s /usr/local/Cellar/qt@5.5/5.5.1_1/mkspecs /usr/local/mkspecs; fi; fi
+- if test $TRAVIS_OS_NAME == osx ; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then ln -s /usr/local/Cellar/qt@5.5/5.5.1_1/plugins /usr/local/plugins; fi; fi
+- if test $TRAVIS_OS_NAME == osx ; then if [[ "$QT_VERSION" == "4.8.7" ]] ; then ln -s /usr/local/Cellar/qt@4/4.8.7_1/mkspecs /usr/local/mkspecs; fi; fi
+- if test $TRAVIS_OS_NAME == osx ; then if [[ "$QT_VERSION" == "4.8.7" ]] ; then ln -s /usr/local/Cellar/qt@4/4.8.7_1/plugins /usr/local/plugins; fi; fi
 - if test $TRAVIS_OS_NAME == osx ; then qmake -v; fi
 
 cache:
@@ -72,6 +95,7 @@ cache:
 
 before_script:
 - if test $TRAVIS_OS_NAME == linux ; then sudo ln -s /usr/bin/x86_64-linux-gnu/libpq.so /usr/bin/libpq.so; fi
+- echo $PATH
 - $SCRIPTS/travis_build_vtk.sh
 - $SCRIPTS/travis_build_itk.sh
 #Install vtk and itk (different version)
index 5c0673d13c3a976fd043b96ff6d1ee82947c4753..e904d36e4641bfd1572030fbd0dbf6fdb1405194 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,4 +3,10 @@
 VV, a 4D image viewer, see : http://vv.creatis.insa-lyon.fr
 
 ### Status
-[![Build Status](https://travis-ci.org/open-vv/vv.svg?branch=master)](https://travis-ci.org/open-vv/vv)
\ No newline at end of file
+[![Build Status](https://travis-ci.org/open-vv/vv.svg?branch=master)](https://travis-ci.org/open-vv/vv)
+
+### Download
+You can download the binaries here:
+ - [Linux 64bits](https://www.creatis.insa-lyon.fr/rio/vv?action=AttachFile&do=get&target=vv-1.4Qt4-linux64)
+ - [Windows 32bits](https://www.creatis.insa-lyon.fr/rio/vv?action=AttachFile&do=get&target=vv-1.4Qt4-win32.zip)
+ - [Windows 64bits](https://www.creatis.insa-lyon.fr/rio/vv?action=AttachFile&do=get&target=vv-1.4Qt4-win64.zip)
\ No newline at end of file
index 76a4286947496f7a523f334d36c439074c53ac75..0d2af3b89fe8f0a66e7eeff091ab6d4c11111ba2 100644 (file)
@@ -3,6 +3,7 @@ if(CLITK_BUILD_TOOLS)
   # Install scripts when running make install
   set(SCRIPTS
     gate_job_cluster.job
+    gate_job_ccin2p3.job
     gate_make_merge_release.sh
     gate_make_release.sh
     gate_power_merge.sh
index e4437808c250c5ca32aa46849860bda8416a4460..c7abaacb11eb6d62d3ef05ca1da5e5735ce725a9 100644 (file)
@@ -9,22 +9,32 @@
 # PARAM
 #
 #$ -P "P_creatis"
-#$ -l vmem=2G
+#$ -l vmem=4G
 #$ -l fsize=1G
 #$ -l ct=30:00:00
 #$ -j yes
 #$ -r no
 
+function transferJobData {
+    echo "Copying data back"
+    pwd
+    echo ${OUTPUTDIR}
+    mkdir "${OUTPUTDIR}/output.${JOB_ID%%.*}"
+    rsync -av --remove-source-files output/ "${OUTPUTDIR}/output.${JOB_ID%%.*}"
+    echo "Cleanup"
+    rm -r ${LOCALMACRODIR}
+}
 
 function error {
-echo "ERROR: $1"
-exit 1
+    echo "ERROR: $1"
+    exit 1
 }
 
 function warning {
-echo "WARNING: $1"
+    echo "WARNING: $1"
 }
 
+date
 test -f ${HOME}/.bashrc && echo "Sourcing bashrc" && source ${HOME}/.bashrc
 set -u
 
@@ -41,30 +51,30 @@ echo "PARAM=${PARAM}"
 
 if test "$RELEASEDIR" = "NONE"
 then
-       echo Using $(which Gate)
-       ldd $(which Gate)
+         echo Using $(which Gate)
+         ldd $(which Gate)
 else
-       test -d "${RELEASEDIR}" || error "can't find release"
-       md5sum ${RELEASEDIR}/Gate
-       test -f ${RELEASEDIR}/libGate.so && md5sum ${RELEASEDIR}/libGate.so
+         test -d "${RELEASEDIR}" || error "can't find release"
+         md5sum ${RELEASEDIR}/Gate
+         test -f ${RELEASEDIR}/libGate.so && md5sum ${RELEASEDIR}/libGate.so
 
-       echo "Finding libraries"
-       ROOTLIBS="${RELEASEDIR}/libCore.so:${RELEASEDIR}/libCint.so:${RELEASEDIR}/libRIO.so:${RELEASEDIR}/libNet.so:${RELEASEDIR}/libHist.so:${RELEASEDIR}/libGraf.so:${RELEASEDIR}/libGraf3d.so:${RELEASEDIR}/libGpad.so:${RELEASEDIR}/libTree.so:${RELEASEDIR}/libRint.so:${RELEASEDIR}/libPostscript.so:${RELEASEDIR}/libMatrix.so:${RELEASEDIR}/libPhysics.so:${RELEASEDIR}/libMathCore.so:${RELEASEDIR}/libThread.so:"
-       echo "ROOTLIBS=${ROOTLIBS}"
-       G4LIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libG4*.so'); do echo -n "${library}:"; done)"
-       echo "G4LIBS=${G4LIBS}"
-       CLHEPLIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libCLHEP*.so'); do echo -n "${library}:"; done)"
-       echo "CLHEPLIBS=${CLHEPLIBS}"
-       GATELIBS=""
-       test -f ${RELEASEDIR}/libGate.so && GATELIBS="${RELEASEDIR}/libGate.so:"
-       echo "GATELIBS=${GATELIBS}"
+         echo "Finding libraries"
+         ROOTLIBS="${RELEASEDIR}/libCore.so:${RELEASEDIR}/libCint.so:${RELEASEDIR}/libRIO.so:${RELEASEDIR}/libNet.so:${RELEASEDIR}/libHist.so:${RELEASEDIR}/libGraf.so:${RELEASEDIR}/libGraf3d.so:${RELEASEDIR}/libGpad.so:${RELEASEDIR}/libTree.so:${RELEASEDIR}/libRint.so:${RELEASEDIR}/libPostscript.so:${RELEASEDIR}/libMatrix.so:${RELEASEDIR}/libPhysics.so:${RELEASEDIR}/libMathCore.so:${RELEASEDIR}/libThread.so:"
+         echo "ROOTLIBS=${ROOTLIBS}"
+         G4LIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libG4*.so'); do echo -n "${library}:"; done)"
+         echo "G4LIBS=${G4LIBS}"
+         CLHEPLIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libCLHEP*.so'); do echo -n "${library}:"; done)"
+         echo "CLHEPLIBS=${CLHEPLIBS}"
+         GATELIBS=""
+         test -f ${RELEASEDIR}/libGate.so && GATELIBS="${RELEASEDIR}/libGate.so:"
+         echo "GATELIBS=${GATELIBS}"
 fi
 test -d "${MACRODIR}" && test -d "${MACRODIR}/mac" || error "invalid macro"
 
 
 echo "Copying inputs"
 LOCALMACRODIR=$(mktemp -d)
-trap "mv output ${OUTPUTDIR}/output.${JOB_ID%%.*} ; rm -r ${LOCALMACRODIR} ; exit 1" 1 2 3 15
+trap "wait ; transferJobData ; exit 1" 1 2 3 15
 cd ${LOCALMACRODIR}
 cp -r -L "${MACRODIR}"/{data,mac} .
 mkdir output
@@ -76,29 +86,24 @@ echo "Lauching macro"
 date
 if test "$RELEASEDIR" = "NONE"
 then
-       Gate ${PARAM} ${MACROFILE} || error "gate failed"
+         Gate ${PARAM} ${MACROFILE} || error "gate failed"
 else
-       LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \
-       G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \
-       G4RADIOACTIVEDATA="${RELEASEDIR}/RadioactiveDecay3.3" \
-       G4LEDATA="${RELEASEDIR}/G4EMLOW6.19" \
-       G4NEUTRONHPDATA="${RELEASEDIR}/G4NDL3.14" \
-       G4ABLADATA="${RELEASEDIR}/G4ABLA3.0" \
-       G4REALSURFACEDATA="${RELEASEDIR}/RealSurface1.0" \
-       G4NEUTRONXSDATA="${RELEASEDIR}/G4NEUTRONXS1.0" \
-       G4PIIDATA="${RELEASEDIR}/G4PII1.2" \
-       /usr/bin/time --format="real %es\nuser %Us\nsys %Ss\nmaxmem %Mk" \
-       ${RELEASEDIR}/Gate ${PARAM} ${MACROFILE} \
-       || error "gate failed"
+         LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \
+                   G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \
+                   G4RADIOACTIVEDATA="${RELEASEDIR}/RadioactiveDecay3.3" \
+                   G4LEDATA="${RELEASEDIR}/G4EMLOW6.19" \
+                   G4NEUTRONHPDATA="${RELEASEDIR}/G4NDL3.14" \
+                   G4ABLADATA="${RELEASEDIR}/G4ABLA3.0" \
+                   G4REALSURFACEDATA="${RELEASEDIR}/RealSurface1.0" \
+                   G4NEUTRONXSDATA="${RELEASEDIR}/G4NEUTRONXS1.0" \
+                   G4PIIDATA="${RELEASEDIR}/G4PII1.2" \
+                   /usr/bin/time --format="real %es\nuser %Us\nsys %Ss\nmaxmem %Mk" \
+                   ${RELEASEDIR}/Gate ${PARAM} ${MACROFILE} \
+             || error "gate failed"
 fi
 
 date
-echo "Copying data back"
-ssh -i ${HOME}/.ssh/ccin2p3 linux1.dg.creatis.insa-lyon.fr "mkdir cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
-rsync -av --remove-source-files -e "ssh -i ${HOME}/.ssh/ccin2p3" output/ "linux1.dg.creatis.insa-lyon.fr:./cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
-
-echo "Cleanup"
-rm -r ${LOCALMACRODIR}
+transferJobData
 date
 
 echo "Success!!!"
index 91120500e4ae817ff51e0ef958125c0843a0ba87..edd798bf62839fdbaccd39d28e828be2086d808e 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/local/bin/bash -lx
+#! /bin/bash -lx
 
 set -u
 SCRIPTNAME="$(basename "${0}")"
@@ -102,13 +102,14 @@ while test $NJOBS -gt 0; do
         PARAM=\"${PARAM}\" INDEX=${NJOBS} INDEXMAX=${NJOBSMAX} OUTPUTDIR=${OUTPUTDIR}  RELEASEDIR=${RELEASEDIR} MACROFILE=${MACROFILE} MACRODIR=${MACRODIR} PBS_JOBID="local_${NJOBS}" bash "${JOBFILE}" > ${OUTPUTDIR}/gate_${NJOBS}.log &
     elif test "$(dnsdomainname)" = "in2p3.fr"
     then
-        PROJECTGROUP=creatis 
+        PROJECTGROUP=creatis
         qsub -o "${OUTPUTDIR}" \
+            -l sps=1 \
              -N "gate.${RUNID}" \
              -v "PARAM=\"${PARAM}\",INDEX=${NJOBS},INDEXMAX=${NJOBSMAX},OUTPUTDIR=${OUTPUTDIR},RELEASEDIR=${RELEASEDIR},MACROFILE=${MACROFILE},MACRODIR=${MACRODIR}" \
              "${JOBFILE}" || error "submission error"
     else
-       qsub -N "gatejob.${RUNID}" -o "${OUTPUTDIR}" \
+        qsub -N "gatejob.${RUNID}" -o "${OUTPUTDIR}" \
            -v "PARAM=${PARAM},INDEX=${NJOBS},INDEXMAX=${NJOBSMAX},OUTPUTDIR=${OUTPUTDIR},RELEASEDIR=${RELEASEDIR},MACROFILE=${MACROFILE},MACRODIR=${MACRODIR}" \
            "${JOBFILE}" || error "submission error"
     fi
@@ -117,7 +118,3 @@ while test $NJOBS -gt 0; do
 done
 
 echo "runid is ${RUNID}"
-if test "$(dnsdomainname)" = "in2p3.fr"
-then
-    rsync -av --remove-source-files -e "ssh -i ${HOME}/.ssh/ccin2p3" ${OUTPUTDIR}/ "linux1.dg.creatis.insa-lyon.fr:./cc/$(basename ${OUTPUTDIR})" --exclude '.__afs*' --exclude "${OUTPUTDIR}/gatejob.*.o*"
-fi
index 2331750a80c279520f69d917f6820cffe4d11911..54a35317f71a5373d213f1f3d52b152ae0869f59 100644 (file)
@@ -20,6 +20,8 @@ endif(BUILD_DOXYGEN)
 # Compilation options
 option(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
 mark_as_advanced(CLITK_EXPERIMENTAL)
+option(CLITK_MEMORY_INFO "Enable memory info (need libstatgrab >= v.0.90)" OFF)
+mark_as_advanced(CLITK_MEMORY_INFO)
 option(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
 option(CLITK_BUILD_SEGMENTATION "Build command-line segmentation tools" OFF)
 option(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
index bdd63163dd9f99822bef2e5d4743d0817d840f3e..a871fecd0d19523b2fa28823856adcf5637c32ed 100644 (file)
@@ -44,15 +44,15 @@ find_package(Gengetopt)
 
 #=========================================================
 # Find libstatgrab is installed, add clitkMemoryUsage.cxx in the library
-#if(NOT DEFINED CLITK_MEMORY_INFO OR CLITK_MEMORY_INFO)
-#  find_library(LIBSTATGRAB NAMES statgrab PATHS)
-#  if(${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+if(NOT DEFINED CLITK_MEMORY_INFO OR CLITK_MEMORY_INFO)
+  find_library(LIBSTATGRAB NAMES statgrab PATHS)
+  if(${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
 #  message("Install libstatgrab (http://www.i-scream.org/libstatgrab/) for memory usage information")
     set(CLITK_MEMORY_INFO OFF)
-#  else(${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
-#    set(CLITK_MEMORY_INFO ON)
-#  endif(${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
-#endif()
+  else(${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+    set(CLITK_MEMORY_INFO ON)
+  endif(${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+endif()
 #=========================================================
 
 
index 94d1c607b6049e7d353e1209a4e31b6ba39b5d77..d7cd4606d4183fe69f36ad4d6d76b69723faa651 100644 (file)
@@ -69,6 +69,9 @@ namespace clitk {
     exit(-3); \
   }
 
+#ifndef ITK_OVERRIDE
+# define ITK_OVERRIDE
+#endif
 
   //--------------------------------------------------------------------
   // when everything goes wrong
index f233f3a4619cf5f8c4f25d2cd48c43d7cf2914c3..2f08938c11824ac45c3517d95237b75b1c234e54 100644 (file)
@@ -59,17 +59,17 @@ public:
   itkTypeMacro(DicomRTDoseIO, ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
-  virtual bool CanReadFile( const char* FileNameToRead );
-  virtual void Read(void * buffer);
+  virtual void ReadImageInformation() ITK_OVERRIDE;
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool keepOfStream);
-  virtual void WriteImageInformation() {
+  virtual void WriteImageInformation() ITK_OVERRIDE {
     WriteImageInformation(false);
   }
-  virtual bool CanWriteFile(const char* filename);
-  virtual void Write(const void* buffer);
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
   template <class T> void dose_copy_raw (float *img_out, T *img_in, int nvox, float scale);
index fc22891fc2a22e7888b26b1995b51606ca10599e..9dae60d77d34db2dedd905515c6817d80c14622c 100644 (file)
@@ -41,11 +41,11 @@ public:
   typedef itk::SmartPointer<const Self>  ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "Dicom RT Dose IO factory";
   }
 
index 9a732befc38bc8ba37be06ab5490474ce3ac42b7..c35f98fb124793efcb8b1238551bfcd7fb77a158 100644 (file)
@@ -23,6 +23,8 @@
 #include <fstream>
 #include <string.h>
 
+#include "clitkCommon.h"
+
 namespace clitk
 {
 
@@ -45,15 +47,15 @@ public:
   itkTypeMacro(EsrfHstImageIO, ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
-  virtual bool CanReadFile( const char* FileNameToRead );
-  virtual void Read(void * buffer);
+  virtual void ReadImageInformation() ITK_OVERRIDE;
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool keepOfStream);
-  virtual void WriteImageInformation() { WriteImageInformation(false); }
-  virtual bool CanWriteFile(const char* filename);
-  virtual void Write(const void* buffer);
+  virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
   std::string m_XmlFileName;
index 0f26584258f7dd6657acb97ce07657873237b2d4..b63d4add4011020598dc8b6a24c6c01b6f2216b2 100644 (file)
@@ -24,6 +24,8 @@
 #include <itkObjectFactoryBase.h>
 #include <itkVersion.h>
 
+#include "clitkCommon.h"
+
 namespace clitk
 {
 
@@ -39,11 +41,11 @@ public:
   typedef itk::SmartPointer<const Self>  ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "Esrf Hst ImageIO Factory, allows the loading of Esrf Hst images into insight";
   }
 
index 1b24a0b59f7524706dd608276ea8b253f925af48..bd2f0a294488e08ed95ed473bf766fd7b44cd23e 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <map>
 
+#include "clitkCommon.h"
+
 namespace clitk
 {
 
@@ -51,17 +53,17 @@ public:
   itkNewMacro(Self);
 
   /** Determine if a file can be read */
-  int CanReadFile(const char* name);
+  int CanReadFile(const char* name) ITK_OVERRIDE;
 
 protected:
   EsrfHstXMLFileReader() {m_OutputObject = &m_Dictionary;};
   virtual ~EsrfHstXMLFileReader() {};
 
-  virtual void StartElement(const char * name,const char **atts);
+  virtual void StartElement(const char * name,const char **atts) ITK_OVERRIDE;
 
-  virtual void EndElement(const char *name);
+  virtual void EndElement(const char *name) ITK_OVERRIDE;
 
-  void CharacterDataHandler(const char *inData, int inLength);
+  void CharacterDataHandler(const char *inData, int inLength) ITK_OVERRIDE;
 
 private:
   EsrfHstXMLFileReader(const Self&); //purposely not implemented
index 7d134de7030ac61afdea880fde62abb2d74dd92a..d5eefc1d7c11fb71a1d5bc2d73ee194f918ffee1 100644 (file)
@@ -30,6 +30,8 @@ typedef unsigned int uint32_t;
 #include <stdint.h>
 #endif
 
+#include "clitkCommon.h"
+
 namespace clitk
 {
 
@@ -59,16 +61,16 @@ public:
   itkTypeMacro(GateAsciiImageIO, ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
-  virtual bool CanReadFile( const char* FileNameToRead );
-  virtual void Read(void * buffer);
+  virtual void ReadImageInformation() ITK_OVERRIDE;
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
-  virtual void WriteImageInformation();
-  virtual bool CanWriteFile(const char* filename);
-  virtual void Write(const void* buffer);
+  virtual void WriteImageInformation() ITK_OVERRIDE;
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
-  virtual bool SupportsDimension(unsigned long dim);
+  virtual bool SupportsDimension(unsigned long dim) ITK_OVERRIDE;
 
 protected:
   static bool ReadHeader(FILE* handle, GateAsciiHeader& header);
index bae5ac3eceb60723d63d34b50f8df974b1b885af..90fd97e1118572a9cb65094eb174058645303299 100644 (file)
@@ -40,11 +40,11 @@ namespace clitk {
            typedef itk::SmartPointer<const Self>  ConstPointer;
 
            /** Class methods used to interface with the registered factories. */
-           const char* GetITKSourceVersion(void) const {
+           const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
                return ITK_SOURCE_VERSION;
            }
 
-           const char* GetDescription(void) const {
+           const char* GetDescription(void) const ITK_OVERRIDE {
                return "GateAscii ImageIO Factory, allows the loading of gate ascii images into insight";
            }
 
index e2a095dab5e080dae4e058b2517be8233c450a45..9cc75d0acce73059b2aba6a083059624e9af66d4 100644 (file)
@@ -1,7 +1,7 @@
 /*=========================================================================
   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
 
-  Authors belong to: 
+  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
@@ -23,7 +23,7 @@
 #  include <unistd.h>
 #endif
 
-void clitk::PrintMemory(bool verbose, std::string s) 
+void clitk::PrintMemory(bool verbose, std::string s)
 {
 #if CLITK_MEMORY_INFO == 1
   if (verbose) {
@@ -38,21 +38,30 @@ void clitk::PrintMemory(bool verbose, std::string s)
 #endif
   }
 
-double clitk::GetMemoryUsageInMb() 
+double clitk::GetMemoryUsageInMb()
 {
 #if CLITK_MEMORY_INFO == 1
   //sleep(1); // wait to refresh memory ? need to let the system refresh the mem
-  int * entries = new int;
-  sg_process_stats * stat = new sg_process_stats;
-  int i=0; 
-  stat = sg_get_process_stats(entries);
+  size_t entries;
+  sg_process_stats *stat;
+  int i=0;
+  sg_init(1);
+
+  stat = sg_get_process_stats(&entries);
+  if(stat == NULL)
+    return 0.0;
+
   // Search the current pid in the list of processes
-  while (stat[i].pid != getpid()) i++;
-  // Display total memory size 
-  double mem = stat[i].proc_resident/1024/1024; // in Mb
+  while (stat->pid != getpid() && i < entries)
+  {
+    ++i;
+    ++stat;
+  }
+
+  // Display total memory size
+  double mem = stat->proc_resident/1000/1000; // in MB
   return mem;
 #else
   return 0.0;
 #endif
   }
-
index 5bdcf887d08891436ac771c119d795e80a71a122..fbe6d9cd6efc9c63f01313b2d76dabffa0422e61 100644 (file)
@@ -60,15 +60,15 @@ namespace clitk {
        itkTypeMacro(VfImageIO, ImageIOBase);
        
        /*-------- This part of the interface deals with reading data. ------ */
-       virtual void ReadImageInformation();
-       virtual bool CanReadFile( const char* FileNameToRead );
-       virtual void Read(void * buffer);
+       virtual void ReadImageInformation() ITK_OVERRIDE;
+       virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
+       virtual void Read(void * buffer) ITK_OVERRIDE;
 
        /*-------- This part of the interfaces deals with writing data. ----- */
        virtual void WriteImageInformation(bool keepOfStream);
-       virtual void WriteImageInformation() { WriteImageInformation(false); }
-       virtual bool CanWriteFile(const char* filename);
-       virtual void Write(const void* buffer);
+       virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
+       virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
+       virtual void Write(const void* buffer) ITK_OVERRIDE;
        
   protected:
        bool mustWriteHeader;
index f00b8d20e3884e877b5fa42bfc505e6d74ba230a..6d790f0ef659641ef35a58182eb5fc090dedc948 100644 (file)
@@ -50,11 +50,11 @@ namespace clitk {
        typedef itk::SmartPointer<const Self>  ConstPointer;
        
        /** Class methods used to interface with the registered factories. */
-       const char* GetITKSourceVersion(void) const {
+       const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
          return ITK_SOURCE_VERSION;
        }
        
-       const char* GetDescription(void) const {
+       const char* GetDescription(void) const ITK_OVERRIDE {
          return "Vf ImageIO Factory, allows the loading of Vf images into insight";
        }
        
index 1d0aced244ee4f5be7bb203ab935f07758e5f8a2..6a4f9246d68a69be9808703225e25dcce2acba7e 100644 (file)
@@ -58,15 +58,15 @@ namespace clitk {
        itkTypeMacro(VoxImageIO, ImageIOBase);
        
        /*-------- This part of the interface deals with reading data. ------ */
-       virtual void ReadImageInformation();
-       virtual bool CanReadFile( const char* FileNameToRead );
-       virtual void Read(void * buffer);
+       virtual void ReadImageInformation() ITK_OVERRIDE;
+       virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
+       virtual void Read(void * buffer) ITK_OVERRIDE;
 
        /*-------- This part of the interfaces deals with writing data. ----- */
        virtual void WriteImageInformation(bool keepOfStream);
-       virtual void WriteImageInformation() { WriteImageInformation(false); }
-       virtual bool CanWriteFile(const char* filename);
-       virtual void Write(const void* buffer);
+       virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
+       virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
+       virtual void Write(const void* buffer) ITK_OVERRIDE;
        
   protected:
        bool mustWriteHeader;
index 70e00a8fef585b6cfee495ae2c88cf46ebbf565c..8ca7ccc913c0a845721a81a76caaba1b23ba1a93 100644 (file)
@@ -49,11 +49,11 @@ namespace clitk {
        typedef itk::SmartPointer<const Self>  ConstPointer;
        
        /** Class methods used to interface with the registered factories. */
-       const char* GetITKSourceVersion(void) const {
+       const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
          return ITK_SOURCE_VERSION;
        }
        
-       const char* GetDescription(void) const {
+       const char* GetDescription(void) const ITK_OVERRIDE {
          return "Vox ImageIO Factory, allows the loading of Vox images into insight";
        }
        
index 98fa7393ac8db3c9ee61c65b7508ae2e0b26b995..3458898fdf99a1405699bf52653e9096ddee068d 100644 (file)
@@ -34,6 +34,8 @@
 #define AVSerror(v)   itkGenericExceptionMacro(<< "Error in clitk::XdrImageIO. Message:" << v);
 #define AVSwarning(v) itkWarningMacro(<< "Error in clitk::XdrImageIO. Message:" << v);
 
+#include "clitkCommon.h"
+
 namespace clitk {
 
 //====================================================================
@@ -61,15 +63,15 @@ public:
     /*-------- This part of the interface deals with reading data. ------ */
     virtual int ReadImageInformationWithError();
     virtual int ReadWithError(void * buffer);
-    virtual void ReadImageInformation();
-    virtual void Read(void * buffer);
-    virtual bool CanReadFile( const char* FileNameToRead );
+    virtual void ReadImageInformation() ITK_OVERRIDE;
+    virtual void Read(void * buffer) ITK_OVERRIDE;
+    virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
 
     /*-------- This part of the interfaces deals with writing data. ----- */
     virtual void WriteImageInformation(bool keepOfStream) {;}
-    virtual void WriteImageInformation() { WriteImageInformation(false); }
-    virtual bool CanWriteFile(const char* FileNameToWrite);
-    virtual void Write(const void* buffer);
+    virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
+    virtual bool CanWriteFile(const char* FileNameToWrite) ITK_OVERRIDE;
+    virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
     void ITKError(std::string funcName, int msgID);
index 8cd00b7c020243d7c107968c448ada527d9fd9d6..47ca942633ddda32afa037395233479357a3f46e 100644 (file)
@@ -50,11 +50,11 @@ public:
     typedef itk::SmartPointer<const Self>  ConstPointer;
 
     /** Class methods used to interface with the registered factories. */
-    const char* GetITKSourceVersion(void) const {
+    const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
         return ITK_SOURCE_VERSION;
     }
 
-    const char* GetDescription(void) const {
+    const char* GetDescription(void) const ITK_OVERRIDE {
         return "Xdr ImageIO Factory, allows the loading of Xdr images into insight";
     }
 
index 83823cb427030353c13479815a8eb1935aed640f..f88b2b7043df90c479eb502fdc6d15c91183fe5b 100644 (file)
@@ -23,6 +23,8 @@
 #include <fstream>
 #include <string.h>
 
+#include "clitkCommon.h"
+
 namespace rtk {
 
 /** \class EdfImageIO
@@ -51,22 +53,22 @@ public:
   itkTypeMacro(EdfImageIO, ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
+  virtual void ReadImageInformation() ITK_OVERRIDE;
 
-  virtual bool CanReadFile( const char* FileNameToRead );
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
 
-  virtual void Read(void * buffer);
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool keepOfStream);
 
-  virtual void WriteImageInformation() {
+  virtual void WriteImageInformation() ITK_OVERRIDE {
     WriteImageInformation(false);
   }
 
-  virtual bool CanWriteFile(const char* filename);
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
 
-  virtual void Write(const void* buffer);
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
   std::string m_BinaryFileName;
index 33eb518f6501d15af90bc382dacc6b4080575571..f789f48db3dffc2bf3ee60cb0ba8cbeeae81c883 100644 (file)
@@ -41,11 +41,11 @@ public:
   typedef itk::SmartPointer<const Self> ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "Edf ImageIO Factory, allows the loading of Edf images into insight";
   }
 
index 030711cf924753b169c54ee91cd90a1d10409b74..9a0e35488fa13a8a600f23a7f0a5ca35ff78daf3 100644 (file)
@@ -22,6 +22,8 @@
 // itk include
 #include <itkImageIOBase.h>
 
+#include "clitkCommon.h"
+
 namespace rtk
 {
 
@@ -54,24 +56,24 @@ public:
   itkTypeMacro(HisImageIO, itk::ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
+  virtual void ReadImageInformation() ITK_OVERRIDE;
 
-  virtual bool CanReadFile( const char* FileNameToRead );
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
 
-  virtual void Read(void * buffer);
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool /*keepOfStream*/) {
     ;
   }
 
-  virtual void WriteImageInformation() {
+  virtual void WriteImageInformation() ITK_OVERRIDE {
     WriteImageInformation(false);
   }
 
-  virtual bool CanWriteFile(const char* filename);
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
 
-  virtual void Write(const void* buffer);
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
   int m_HeaderSize;
index fbaccda13a5c3cb75ba8b9bf6676f6ddfe9ad477..bb45d20eb2e792c62eb79659a1ce0aa714d26ac1 100644 (file)
@@ -44,11 +44,11 @@ public:
   typedef itk::SmartPointer<const Self> ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "His ImageIO Factory, allows the loading of His images into insight";
   }
 
index 6f32ec94a593d57920e8172048c4efa53cc17a2d..f88e11e9d5936ff41e7b2dfcd8d88414f1e029d5 100644 (file)
@@ -29,6 +29,8 @@
 #include <stdint.h>
 #endif
 
+#include "clitkCommon.h"
+
 namespace rtk {
 
 /** \class HndImageIO
@@ -121,20 +123,20 @@ public:
   itkTypeMacro(HndImageIO, itk::ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
+  virtual void ReadImageInformation() ITK_OVERRIDE;
 
-  virtual bool CanReadFile( const char* FileNameToRead );
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
 
-  virtual void Read(void * buffer);
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool /*keepOfStream*/) { }
 
-  virtual void WriteImageInformation() { WriteImageInformation(false); }
+  virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
 
-  virtual bool CanWriteFile(const char* filename);
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
 
-  virtual void Write(const void* buffer);
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 }; // end class HndImageIO
 
index a410e62787e70f455b1ea51216ab099a40f58aaa..24ca3a1bc1780c0e76ebcf9ebef39f3a498f6a03 100644 (file)
@@ -47,11 +47,11 @@ public:
   typedef itk::SmartPointer<const Self> ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "His ImageIO Factory, allows the loading of His images into insight";
   }
 
index bbdc6a855ca6ca0f7b88bab08d505ec00449322d..387dd68a217c9b596a75e2287ff8607abb68374e 100644 (file)
@@ -23,6 +23,8 @@
 #include <fstream>
 #include <string.h>
 
+#include "clitkCommon.h"
+
 namespace rtk
 {
 
@@ -48,19 +50,19 @@ public:
   itkTypeMacro(ImagXImageIO, ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
+  virtual void ReadImageInformation() ITK_OVERRIDE;
 
-  virtual bool CanReadFile( const char* FileNameToRead );
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
 
-  virtual void Read(void * buffer);
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool keepOfStream);
 
-  virtual void WriteImageInformation() { WriteImageInformation(false); }
-  virtual bool CanWriteFile(const char* filename);
+  virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
 
-  virtual void Write(const void* buffer);
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
   std::string m_RawFileName;
index 2466e9d9607bbf7bd18ebb19840341115edcc925..da584f73c53466c44249e591982b3cf12f0a7d0d 100644 (file)
@@ -42,11 +42,11 @@ public:
   typedef itk::SmartPointer<const Self> ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "ImagX ImageIO Factory, allows the loading of ImagX images into insight";
   }
 
index 1a948e2edcd29ddcab54c3db7cc258d104eaf362..e3493c162a7d60cedd77f22187ebe3d91aaedba0 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <map>
 
+#include "clitkCommon.h"
+
 namespace rtk
 {
 
@@ -51,17 +53,17 @@ public:
   itkNewMacro(Self);
 
   /** Determine if a file can be read */
-  int CanReadFile(const char* name);
+  int CanReadFile(const char* name) ITK_OVERRIDE;
 
 protected:
   ImagXXMLFileReader() {m_OutputObject = &m_Dictionary;}
   virtual ~ImagXXMLFileReader() {}
 
-  virtual void StartElement(const char * name,const char **atts);
+  virtual void StartElement(const char * name,const char **atts) ITK_OVERRIDE;
 
-  virtual void EndElement(const char *name);
+  virtual void EndElement(const char *name) ITK_OVERRIDE;
 
-  void CharacterDataHandler(const char *inData, int inLength);
+  void CharacterDataHandler(const char *inData, int inLength) ITK_OVERRIDE;
 
 private:
   ImagXXMLFileReader(const Self&); //purposely not implemented
index 822945503be8e82cf62d177cc1e97d7857d1137d..65d2d11da3cdfa92882f2cded03bc305d8f69e59 100644 (file)
@@ -23,6 +23,8 @@
 #include <fstream>
 #include <string.h>
 
+#include "clitkCommon.h"
+
 namespace rtk {
 
 /** \class XRadImageIO
@@ -51,22 +53,22 @@ public:
   itkTypeMacro(XRadImageIO, ImageIOBase);
 
   /*-------- This part of the interface deals with reading data. ------ */
-  virtual void ReadImageInformation();
+  virtual void ReadImageInformation() ITK_OVERRIDE;
 
-  virtual bool CanReadFile( const char* FileNameToRead );
+  virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
 
-  virtual void Read(void * buffer);
+  virtual void Read(void * buffer) ITK_OVERRIDE;
 
   /*-------- This part of the interfaces deals with writing data. ----- */
   virtual void WriteImageInformation(bool keepOfStream);
 
-  virtual void WriteImageInformation() {
+  virtual void WriteImageInformation() ITK_OVERRIDE {
     WriteImageInformation(false);
   }
 
-  virtual bool CanWriteFile(const char* filename);
+  virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
 
-  virtual void Write(const void* buffer);
+  virtual void Write(const void* buffer) ITK_OVERRIDE;
 
 protected:
 
index 1651918a33b15ab7072ea5d0a7330d35911c4cfe..23cb63e14e0573bf7e1be78e7b68bce22a93a56e 100644 (file)
@@ -41,11 +41,11 @@ public:
   typedef itk::SmartPointer<const Self> ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
-  const char* GetITKSourceVersion(void) const {
+  const char* GetITKSourceVersion(void) const ITK_OVERRIDE {
     return ITK_SOURCE_VERSION;
   }
 
-  const char* GetDescription(void) const {
+  const char* GetDescription(void) const ITK_OVERRIDE {
     return "XRad ImageIO Factory, allows the loading of XRad images into insight";
   }
 
index 47a0e3464bd1d6e995b8a3103bab742566a5459b..c7e13cc60b12fe9b98193efb232c8b1792802371 100644 (file)
@@ -196,7 +196,7 @@ unsigned long vvImage::GetActualMemorySize()
 {
   unsigned long size = 0;
   for (unsigned int i = 0; i < mVtkImages.size(); i++) {
-    size += mVtkImages[i]->GetActualMemorySize();
+    size += mVtkImages[i]->GetActualMemorySize()*1024;
   }
   return size;
 }
index d1fddfb58639143a45b4b616be5d034880e93265..a9f17ab6afe7c8d08aec0ffa2ba2613885304983 100644 (file)
@@ -157,11 +157,17 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
     spacing.Fill(1);
     typename OutputImageType::PointType origin;
     origin.Fill(0);
+    typename OutputImageType::DirectionType direction;
+    direction.SetIdentity();
     for (unsigned int pixelDim=0; pixelDim<VImageDimension-1; ++pixelDim)
     {
       size[pixelDim]=adaptor->GetLargestPossibleRegion().GetSize(pixelDim);
       spacing[pixelDim]=input->GetSpacing()[pixelDim];
       origin[pixelDim]=input->GetOrigin()[pixelDim];
+      for (unsigned int pixelDim2=0; pixelDim2<VImageDimension-1; ++pixelDim2)
+      {
+        direction[pixelDim][pixelDim2]=input->GetDirection()[pixelDim][pixelDim2];
+      }
     }
     typename OutputImageType::RegionType region;
     region.SetSize(size);
@@ -169,6 +175,7 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
     output->SetRegions(region);
     output->SetOrigin(origin);
     output->SetSpacing(spacing);
+    output->SetDirection(direction);
     output->Allocate();
 
     //Copy each channel
@@ -193,10 +200,10 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
       }
     }
 
-    if (VImageDimension == 4)
+/*    if (VImageDimension == 4)
       mType == VECTORPIXELIMAGEWITHTIME;
     else
-      mType == VECTORPIXELIMAGE;
+      mType == VECTORPIXELIMAGE;*/
 
     try {
       mImage = vvImageFromITK<VImageDimension,InputPixelType>(output, mType == VECTORPIXELIMAGEWITHTIME);
index 183f260e0bee422f9a632a668f42fc6c91317274..c4f081287b2b469176c15352bc5c902a2240d866 100644 (file)
@@ -170,8 +170,8 @@ namespace itk
     }
   
 
-    virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
-    void EnlargeOutputRequestedRegion (DataObject * output);
+    virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE;
+    void EnlargeOutputRequestedRegion (DataObject * output) ITK_OVERRIDE;
 
   protected:
     RelativePositionPropImageFilter()
@@ -185,10 +185,10 @@ namespace itk
         m_VerboseProgress = false;
       }
     virtual ~RelativePositionPropImageFilter() {}
-    void PrintSelf(std::ostream& os, Indent indent) const;
+    void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
 
     //void GenerateThreadedData(const typename TOutputImage::RegionType& outputRegionForThread, int threadId);
-    void GenerateData();
+    void GenerateData() ITK_OVERRIDE;
 
   private:
     RelativePositionPropImageFilter(const Self&); //purposely not implemented
index 781775f0cc9541c488ca0ddfa4b8566b8ddc9779..45f331ed9d7cf5e55989a1852a54f9737bdccc90 100644 (file)
@@ -85,7 +85,7 @@ namespace clitk {
     } OrientationTypeEnumeration;
 
     /** Input : initial image and object */
-    void SetInput(const ImageType * image);
+    void SetInput(const ImageType * image) ITK_OVERRIDE;
     void SetInputObject(const ImageType * image);
     
     // Options
@@ -149,7 +149,7 @@ namespace clitk {
     typename FloatImageType::Pointer GetFuzzyMap() { return m_FuzzyMap; }
 
     // I dont want to verify inputs information
-    virtual void VerifyInputInformation() { }
+    virtual void VerifyInputInformation() ITK_OVERRIDE { }
     
     // For debug
     void PrintOptions();
@@ -176,9 +176,9 @@ namespace clitk {
     double m_Radius;
     double m_K1;
 
-    virtual void GenerateOutputInformation();
-    virtual void GenerateInputRequestedRegion();
-    virtual void GenerateData();
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
 
     typedef itk::PasteImageFilter<ImageType,ImageType> PasteFilterType;
     typedef itk::PasteImageFilter<FloatImageType,FloatImageType> PasteFloatFilterType;
index 98ab74f8fa7b3ab9a7817da518478b83a40abd5c..f24aa05c09e506a34b9bc970e4705b8298727ad1 100644 (file)
@@ -54,7 +54,7 @@ namespace clitk {
     typedef long LabelType;
 
     /** Connect one of the operands for pixel-wise addition */
-    void SetInput( const ImageType * image);
+    void SetInput( const ImageType * image) ITK_OVERRIDE;
     
     // LabelImage information (BG)
     void SetBackgroundValue(ImagePixelType p);
@@ -71,8 +71,8 @@ namespace clitk {
     AutoCropFilter();
     virtual ~AutoCropFilter() {}
     
-    virtual void GenerateOutputInformation();
-    virtual void GenerateData();
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
     
     ImagePixelType m_BackgroundValue;
     ImageRegionType m_Region;
index adb7116ea10b2c9aecc332f557ec98c486f921d2..e7d1b73113fb99918b1dd001308373f76a880b87 100644 (file)
@@ -99,18 +99,18 @@ namespace clitk {
     itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
 
     // I dont want to verify inputs information
-    virtual void VerifyInputInformation() { }
+    virtual void VerifyInputInformation() ITK_OVERRIDE { }
     
   protected:
     BooleanOperatorLabelImageFilter();
     virtual ~BooleanOperatorLabelImageFilter() {}
     
-    virtual void GenerateOutputInformation();
-    virtual void GenerateInputRequestedRegion();
-    virtual void GenerateData();
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
     
     // Do not release date to keep input in memory and continue ... 
-    virtual void ReleaseInputs() { } 
+    virtual void ReleaseInputs() ITK_OVERRIDE { }
     
     Input1ImagePixelType mBackgroundValue1;
     Input2ImagePixelType mBackgroundValue2;
index cc7623f5741a49a2d4e0efc735e95ecd8a9311a5..47ae445a2b2312c53b6e8521b684110f0449e205 100644 (file)
@@ -71,15 +71,15 @@ namespace clitk {
     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
 
     // I dont want to verify inputs information
-    virtual void VerifyInputInformation() { }
+    virtual void VerifyInputInformation() ITK_OVERRIDE { }
 
   protected:
     CropLikeImageFilter();
     virtual ~CropLikeImageFilter() {}
 
-    virtual void GenerateOutputInformation();
-    virtual void GenerateData();
-    virtual void GenerateInputRequestedRegion();
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
 
     PixelType m_BackgroundValue;
     RegionType m_OutputRegion;
index 9211418f070c60998e06d2107b502bc8c8fca1e7..f7a31dcf99d1e4777c65a67e425a939453434699 100644 (file)
@@ -62,7 +62,7 @@ public:
   typedef typename OutputImageType::RegionType OutputImageRegionType; 
   typedef typename OutputImageType::PixelType  OutputImagePixelType; 
   
-  void PrintSelf ( std::ostream& os, itk::Indent indent ) const;
+  void PrintSelf ( std::ostream& os, itk::Indent indent ) const ITK_OVERRIDE;
 
   /** Clear the seeds */
   void ClearSeeds();
@@ -178,11 +178,11 @@ protected:
   unsigned int m_MinimumSize;
 
   // Override since the filter needs all the data for the algorithm
-  void GenerateInputRequestedRegion();
+  void GenerateInputRequestedRegion() ITK_OVERRIDE;
 
   // Override since the filter produces the entire dataset
-  void EnlargeOutputRequestedRegion(itk::DataObject *output);
-  void GenerateData();
+  void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE;
+  void GenerateData() ITK_OVERRIDE;
   
 private:
   ExplosionControlledThresholdConnectedImageFilter(const Self&); //purposely not implemented
index 2cdabcf4d4bbec191c9b0929330ed8d9ae1ff47e..30976ce2f0dd0e59f449032a18ca438e0804328c 100644 (file)
@@ -81,7 +81,7 @@ namespace clitk {
     FILTERBASE_INIT;
 
     /** Input : initial image and object */
-    void SetInput(const ImageType * image);
+    void SetInput(const ImageType * image) ITK_OVERRIDE;
     
     // Options
     itkGetConstMacro(Direction, int);
@@ -96,9 +96,9 @@ namespace clitk {
     
     int m_Direction;
 
-    virtual void GenerateOutputInformation();
-    virtual void GenerateInputRequestedRegion();
-    virtual void GenerateData();
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
 
     int m_NumberOfSlices;
     ImagePointer input;
index 8475241a3171d1b4edb2a8a50c1b5b8a5a92211d..52edcd922238be7a444694d062d66b593b2df5c1 100644 (file)
@@ -65,7 +65,7 @@ namespace clitk
     //Set Methods(inline)
     itkSetMacro( Verbose, bool);
     itkSetMacro( EdgePaddingValue, PixelType );
-    void SetNumberOfThreads(unsigned int r )
+    void SetNumberOfThreads(unsigned int r ) ITK_OVERRIDE
     {
       m_NumberOfThreadsIsGiven=true;
       m_NumberOfThreads=r;
@@ -78,7 +78,7 @@ namespace clitk
   protected:
     InvertVFFilter();
     ~InvertVFFilter() {};
-    void GenerateData( );
+    void GenerateData( ) ITK_OVERRIDE;
     
     bool m_Verbose;
     bool m_NumberOfThreadsIsGiven;
index c32782f08b84558f1bcf2cc4fa6f59976f94bd4f..4b982308cf2afcf906e0fd955f2bbad3c8b27be6 100644 (file)
@@ -74,8 +74,8 @@ protected:
   ~HelperClass1() {};
 
   //the actual processing
-  void BeforeThreadedGenerateData();
-  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
+  void BeforeThreadedGenerateData() ITK_OVERRIDE;
+  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE;
 
   //member data
   typename  WeightsImageType::Pointer m_Weights;
@@ -289,7 +289,7 @@ protected:
 
 
   //the actual processing
-  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
+  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE;
 
   //member data
   typename     WeightsImageType::Pointer m_Weights;
index 6b32e829dace22bb256dd1bfdf57da7d420fb741..f05c892d14b95cbbe16f7772ebd35c01da64e6c1 100644 (file)
@@ -71,17 +71,17 @@ public:
   itkGetConstReferenceMacro(Radius, InputSizeType);
 
   /** Evalulate the function at specified index */
-  virtual bool EvaluateAtIndex( const IndexType& index ) const;
+  virtual bool EvaluateAtIndex( const IndexType& index ) const ITK_OVERRIDE;
   
   /** Evaluate the function at non-integer positions */
-  virtual bool Evaluate( const PointType& point ) const
+  virtual bool Evaluate( const PointType& point ) const ITK_OVERRIDE
     { 
     IndexType index;
     this->ConvertPointToNearestIndex( point, index );
     return this->EvaluateAtIndex( index ); 
     }
   virtual bool EvaluateAtContinuousIndex( 
-    const ContinuousIndexType& cindex ) const
+    const ContinuousIndexType& cindex ) const ITK_OVERRIDE
     { 
     IndexType index;
     this->ConvertContinuousIndexToNearestIndex( cindex, index );
@@ -108,7 +108,7 @@ public:
 protected:
   LocallyAdaptiveBinaryThresholdImageFunction();
   ~LocallyAdaptiveBinaryThresholdImageFunction(){};
-  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
 
 private:
   LocallyAdaptiveBinaryThresholdImageFunction( const Self& ); //purposely not implemented
index dc71f7fea7853739f7ad26289b1732d54a75a017..2d38caaefde6adf5d56cd33292913cfd48699fc1 100644 (file)
@@ -61,7 +61,7 @@ public:
   typedef typename OutputImageType::RegionType OutputImageRegionType; 
   typedef typename OutputImageType::PixelType  OutputImagePixelType; 
   
-  void PrintSelf ( std::ostream& os, itk::Indent indent ) const;
+  void PrintSelf ( std::ostream& os, itk::Indent indent ) const ITK_OVERRIDE;
 
   /** Clear the seeds */
   void ClearSeeds();
@@ -145,11 +145,11 @@ protected:
   double m_MaximumSD;
 
   // Override since the filter needs all the data for the algorithm
-  void GenerateInputRequestedRegion();
+  void GenerateInputRequestedRegion() ITK_OVERRIDE;
 
   // Override since the filter produces the entire dataset
-  void EnlargeOutputRequestedRegion(itk::DataObject *output);
-  void GenerateData();
+  void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE;
+  void GenerateData() ITK_OVERRIDE;
   
 private:
   LocallyAdaptiveThresholdConnectedImageFilter(const Self&); //purposely not implemented
index 72550cfdfe3b7ac9b31c6525aa4f863d0cddd91e..5f286b3dd30e0d0a5de23d3fe3af1db4f967d83a 100644 (file)
@@ -18,7 +18,7 @@ namespace clitk
     public itk::PasteImageFilter< TInputImage, TSourceImage, TOutputImage >
   {
   public:
-    virtual void VerifyInputInformation() { }
+    virtual void VerifyInputInformation() ITK_OVERRIDE { }
 
     /** Standard class typedefs. */
     typedef PasteImageFilter                                Self;
index 4b6b409d37caaa492ef14769dc4f45b127898323..f3de134ce14f9b8d1c81753968e598f47c8f1616 100644 (file)
@@ -22,6 +22,8 @@
 #include "itkImageToImageFilter.h"
 #include "itkAffineTransform.h"
 
+#include "clitkCommon.h"
+
 namespace clitk {
   
   //--------------------------------------------------------------------
@@ -84,7 +86,7 @@ namespace clitk {
                  (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
 
   /** Input : image to resample */
-  void SetInput(const InputImageType * image);
+  void SetInput(const InputImageType * image) ITK_OVERRIDE;
     
   /** ImageDimension constants */
   itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
@@ -139,9 +141,9 @@ namespace clitk {
   bool m_VerboseOptions;
   OutputImageRegionType m_OutputRegion;
 
-  virtual void GenerateInputRequestedRegion();
-  virtual void GenerateOutputInformation();
-  virtual void GenerateData();
+  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+  virtual void GenerateOutputInformation() ITK_OVERRIDE;
+  virtual void GenerateData() ITK_OVERRIDE;
     
   private:
   ResampleImageWithOptionsFilter(const Self&); //purposely not implemented
index e5ac118e58c8bf3a1d6de546b1b54a6dae80f241..500ecc4dc1603b83524c5585f70f7ebacb46cacc 100644 (file)
@@ -20,6 +20,8 @@
 #include "itkFlexibleBinaryFunctorImageFilter.h"
 #include "itkNumericTraits.h"
 
+#include "clitkCommon.h"
+
 
 namespace clitk
 {
@@ -211,7 +213,7 @@ protected:
   SetBackgroundImageFilter() {}
   virtual ~SetBackgroundImageFilter() {}
 
-  void PrintSelf(std::ostream &os, itk::Indent indent) const
+  void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE
     {
     Superclass::PrintSelf(os, indent);
     os << indent << "OutsideValue: "  << this->GetOutsideValue() << std::endl;
index ec1246fed428e9b60e7f12acb336c18f2a839bb3..42633a929daf2286a92ff4741308eb5061d699df 100644 (file)
@@ -67,7 +67,7 @@ namespace clitk {
     typedef typename RelPosFilterType::OrientationTypeEnumeration OrientationTypeEnumeration;
     
     /** Input : initial image and object */
-    void SetInput(const ImageType * image);
+    virtual void SetInput(const ImageType * image) ITK_OVERRIDE;
     void SetInputObject(const ImageType * image);
 
     // Options
@@ -106,9 +106,9 @@ namespace clitk {
     SliceBySliceRelativePositionFilter();
     virtual ~SliceBySliceRelativePositionFilter() {}
     
-    virtual void GenerateOutputInformation();
-    virtual void GenerateInputRequestedRegion();
-    virtual void GenerateData();
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
 
     ImagePointer input;
     ImagePointer object;
index 7fd7ab81e0686efcb26a4035d487958eaebaed22..5ca614d9c35d493a487c7347be9111af3f339a87 100644 (file)
@@ -21,6 +21,8 @@
 #include "itkBSplineWeightsCalculator.h"
 #include <itkBSplineInterpolateImageFunction.h>
 
+#include "clitkCommon.h"
+
 namespace itk {
   
   template <
@@ -59,19 +61,19 @@ namespace itk {
     void SetSplineOrders(const  SizeType & SplineOrders);
 
     /** Set the input image.  This must be set by the user. */
-    virtual void SetInputImage(const TImageType * inputData);
+    virtual void SetInputImage(const TImageType * inputData) ITK_OVERRIDE;
     
     /** Evaluate the function at a ContinuousIndex position.
   Overwritten for taking LUT into account (RP: multi-threading-compatible version, 
   the threadID is actually ignored) */  
-    virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index, unsigned int /* threadID */ ) const
+    virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index, unsigned int /* threadID */ ) const ITK_OVERRIDE
     {
       return this->EvaluateAtContinuousIndex( index );
     }
 
     /** Evaluate the function at a ContinuousIndex position.
        Overwritten for taking LUT into account */  
-    virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index ) const;
+    virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index ) const ITK_OVERRIDE;
     
     /** Static convenient functions to compute BSpline weights for
        various order, dimension, sampling ... **/
index 6b85a096a3c0dcdd83dc9cdc9a8f9d4e18785805..f8736d7e1cf04e43c3002c4dc86789378544c24a 100644 (file)
@@ -20,6 +20,8 @@
 #include "itkInPlaceImageFilter.h"
 #include "itkImageRegionIteratorWithIndex.h"
 
+#include "clitkCommon.h"
+
 namespace itk
 {
   
@@ -109,8 +111,8 @@ public:
       }
     }
 
-  virtual void GenerateOutputInformation();
-  virtual void GenerateInputRequestedRegion();
+  virtual void GenerateOutputInformation() ITK_OVERRIDE;
+  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
 
   /** ImageDimension constants */
   itkStaticConstMacro(
@@ -146,7 +148,7 @@ protected:
    * \sa ImageToImageFilter::ThreadedGenerateData(),
    *     ImageToImageFilter::GenerateData()  */
   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
-                            itk::ThreadIdType threadId );
+                            itk::ThreadIdType threadId ) ITK_OVERRIDE;
 
 private:
   FlexibleBinaryFunctorImageFilter(const Self&); //purposely not implemented
index bcf5fd4cb05a0d29e8630b398f2577a0e35cec2c..f369e0506e838492f560f5f8e525771bf8cd377c 100644 (file)
@@ -45,11 +45,11 @@ public:
   }
 
   // Execute
-  void Execute(itk::Object *caller, const itk::EventObject & event) {
+  void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE {
     Execute( (const itk::Object *)caller, event);
   }
 
-  void Execute(const itk::Object * object, const itk::EventObject & event) {
+  void Execute(const itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE {
     if ( !(itk::IterationEvent().CheckEvent( &event )) ) {
       return;
     }
@@ -108,7 +108,7 @@ public:
   // Two arguments are passed to the Execute() method: the first
   // is the pointer to the object which invoked the event and the
   // second is the event that was invoked.
-  void Execute(itk::Object * object, const itk::EventObject & event) {
+  void Execute(itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE {
     if ( !(itk::IterationEvent().CheckEvent( &event )) ) {
       return;
     }
@@ -138,7 +138,7 @@ public:
     }
   }
 
-  void Execute(const itk::Object * , const itk::EventObject & ) {
+  void Execute(const itk::Object * , const itk::EventObject & ) ITK_OVERRIDE {
     return;
   }
 
index 40eb129d084e3c8bec1f0dabfcd8e9681c5f9477..dc85c7a445db478bf15294d68870d80b9d26decf 100644 (file)
@@ -43,7 +43,11 @@ namespace clitk
 
     typedef clitk::BSplineDeformableTransform<double, TDVFType::ImageDimension, TDVFType::ImageDimension> BLUTTransformType;
     typedef typename BLUTTransformType::CoefficientImageType BLUTCoefficientImageType;
-    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, TDVFType::ImageDimension> ITKTransformType;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 3> ITKTransformType;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 0> ITKTransformTypeZero;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 1> ITKTransformTypeOne;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 2> ITKTransformTypeTwo;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 4> ITKTransformTypeFour;
 
     typedef itk::Transform< double, TDVFType::ImageDimension, TDVFType::ImageDimension> GenericTransformType;
     
index ef63900717289f73c0fc3b71969c8a7a0c44ec6c..9bda80f8ec0aa03d38b9031875955bc6fc5b584d 100644 (file)
@@ -162,23 +162,64 @@ namespace clitk
         for (unsigned int j=0; j < coefficient_images[i]->GetPixelContainer()->Size(); j++)
           params[input->GetPixelContainer()->Size() * i + j] = coefficient_images[i]->GetPixelContainer()->GetBufferPointer()[j]; 
       }
+      typename ITKTransformTypeZero::Pointer zero;
+      typename ITKTransformTypeOne::Pointer one;
+      typename ITKTransformTypeTwo::Pointer two;
+      typename ITKTransformTypeFour::Pointer four;
 
-      m_ITKTransform->SetGridOrigin(input->GetOrigin());
-      m_ITKTransform->SetGridDirection(input->GetDirection());
-      m_ITKTransform->SetGridRegion(input->GetLargestPossibleRegion());
-      m_ITKTransform->SetGridSpacing(input->GetSpacing());
-      m_ITKTransform->SetParametersByValue(params);
-
-      m_GenericTransform = m_ITKTransform;
+      switch(m_BLUTSplineOrders[0])
+      {
+        case 0:
+          zero = ITKTransformTypeZero::New();
+          zero->SetGridOrigin(input->GetOrigin());
+          zero->SetGridDirection(input->GetDirection());
+          zero->SetGridRegion(input->GetLargestPossibleRegion());
+          zero->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = zero;
+          break;
+        case 1:
+          one = ITKTransformTypeOne::New();
+          one->SetGridOrigin(input->GetOrigin());
+          one->SetGridDirection(input->GetDirection());
+          one->SetGridRegion(input->GetLargestPossibleRegion());
+          one->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = one;
+          break;
+        case 2:
+          two = ITKTransformTypeTwo::New();
+          two->SetGridOrigin(input->GetOrigin());
+          two->SetGridDirection(input->GetDirection());
+          two->SetGridRegion(input->GetLargestPossibleRegion());
+          two->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = two;
+          break;
+        case 3:
+          m_ITKTransform = ITKTransformType::New();
+          m_ITKTransform->SetGridOrigin(input->GetOrigin());
+          m_ITKTransform->SetGridDirection(input->GetDirection());
+          m_ITKTransform->SetGridRegion(input->GetLargestPossibleRegion());
+          m_ITKTransform->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = m_ITKTransform;
+          break;
+        case 4:
+          four = ITKTransformTypeFour::New();
+          four->SetGridOrigin(input->GetOrigin());
+          four->SetGridDirection(input->GetDirection());
+          four->SetGridRegion(input->GetLargestPossibleRegion());
+          four->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = four;
+          break;
+      }
+      m_GenericTransform->SetParametersByValue(params);
     }
 
 #if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 6)
-    m_Filter->SetReferenceImage(output);
+    m_Filter->SetSize(output->GetLargestPossibleRegion().GetSize());
 #else
-    m_Filter->SetOutputOrigin(output->GetOrigin());
-    m_Filter->SetOutputSpacing(output->GetSpacing());
     m_Filter->SetOutputSize(output->GetLargestPossibleRegion().GetSize());
 #endif
+    m_Filter->SetOutputOrigin(output->GetOrigin());
+    m_Filter->SetOutputSpacing(output->GetSpacing());
     m_Filter->SetTransform(m_GenericTransform);
 
     m_Filter->Update();
index c8f9d21475cc4bf65b0a1775b6c40f28ea0203c6..04a6a3737470da8629af3c786502a3f1eeb30446 100644 (file)
@@ -105,18 +105,18 @@ public:
     *  (1) making sure that all the components are present and plugged
     *      together correctly,
     *  (3) allocate memory for bin data structures. */
-  virtual void Initialize(void) throw ( ExceptionObject );
+  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const TransformParametersType & parameters,
-                      DerivativeType & derivative ) const;
+                      DerivativeType & derivative ) const ITK_OVERRIDE;
 
   /**  Get the value for single valued optimizers. */
-  MeasureType GetValue( const TransformParametersType & parameters ) const;
+  MeasureType GetValue( const TransformParametersType & parameters ) const ITK_OVERRIDE;
 
   /**  Get value and derivatives for multiple valued optimizers. */
   void GetValueAndDerivative( const TransformParametersType & parameters,
-                              MeasureType& Value, DerivativeType& Derivative ) const;
+                              MeasureType& Value, DerivativeType& Derivative ) const ITK_OVERRIDE;
 
   /** Number of bins to used in the calculation. Typical value is 50. */
   itkSetClampMacro( NumberOfBins, unsigned long,
index 7b4052eab10708bc38d6cd7c65f7d330b2f0cd3a..4ea8924b270a95c8bd5553a4a84ad2ca6386dd1b 100644 (file)
@@ -19,6 +19,8 @@
 #define __clitkLBFGSBOptimizer_h
 #include "itkSingleValuedNonLinearVnlOptimizer.h"
 
+#include "clitkCommon.h"
+
 namespace clitk
 {
 
@@ -93,10 +95,10 @@ public:
 
 
   /** Start optimization with an initial value. */
-  void StartOptimization( void );
+  virtual void StartOptimization( void ) ITK_OVERRIDE;
 
   /** Plug in a Cost Function into the optimizer  */
-  virtual void SetCostFunction( itk::SingleValuedCostFunction * costFunction );
+  virtual void SetCostFunction( itk::SingleValuedCostFunction * costFunction ) ITK_OVERRIDE;
 
   /** Set the lower bound value for each variable. */
   virtual void SetLowerBound( const BoundValueType & value );
@@ -160,12 +162,12 @@ public:
   itkGetConstReferenceMacro( InfinityNormOfProjectedGradient, double );
 
   /** Get the reason for termination */
-  const std::string GetStopConditionDescription() const;
+  virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
 
 protected:
   LBFGSBOptimizer();
   virtual ~LBFGSBOptimizer();
-  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
 
   typedef Superclass::CostFunctionAdaptorType   CostFunctionAdaptorType;
 
index 242a4a1934b48ad6089e1927a2fffb77f3f273d0..46dcae977f831413a449408d6bc341b1d611d9ce 100644 (file)
@@ -95,25 +95,25 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
-  virtual void Initialize(void) throw ( itk::ExceptionObject );
+  virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
 
   /**  Get the value. */
-  MeasureType GetValue( const ParametersType & parameters ) const;
+  MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const ParametersType & parameters,
-                      DerivativeType & Derivative ) const;
+                      DerivativeType & Derivative ) const ITK_OVERRIDE;
 
   /**  Get the value and derivatives for single valued optimizers. */
   void GetValueAndDerivative( const ParametersType & parameters,
                               MeasureType & Value,
-                              DerivativeType & Derivative ) const;
+                              DerivativeType & Derivative ) const ITK_OVERRIDE;
 
 protected:
 
   NormalizedCorrelationImageToImageMetric();
   virtual ~NormalizedCorrelationImageToImageMetric();
-  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
 
 private:
 
@@ -129,7 +129,7 @@ private:
   inline bool GetValueThreadProcessSample( unsigned int threadID,
       unsigned long fixedImageSample,
       const MovingImagePointType & mappedPoint,
-      double movingImageValue ) const;
+      double movingImageValue ) const ITK_OVERRIDE;
 
 
   inline bool GetValueAndDerivativeThreadProcessSample( unsigned int threadID,
@@ -137,7 +137,7 @@ private:
       const MovingImagePointType & mappedPoint,
       double movingImageValue,
       const ImageDerivativesType &
-      movingImageGradientValue ) const;
+      movingImageGradientValue ) const ITK_OVERRIDE;
 
   AccumulateType *m_ThreaderSFF, *m_ThreaderSMM, *m_ThreaderSFM, *m_ThreaderSF, *m_ThreaderSM;
   mutable AccumulateType m_SFF, m_SMM, m_SFM, m_SF, m_SM;
index dc7ef9feb294aeba79a8f0860284af692b447ec0..24afdbe2ff027ac6da61eb51d4bdd0e7199223ce 100644 (file)
@@ -95,25 +95,25 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
-  virtual void Initialize(void) throw ( itk::ExceptionObject );
+  virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
 
   /**  Get the value. */
-  MeasureType GetValue( const ParametersType & parameters ) const;
+  MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const ParametersType & parameters,
-                      DerivativeType & Derivative ) const;
+                      DerivativeType & Derivative ) const ITK_OVERRIDE;
 
   /**  Get the value and derivatives for single valued optimizers. */
   void GetValueAndDerivative( const ParametersType & parameters,
                               MeasureType & Value,
-                              DerivativeType & Derivative ) const;
+                              DerivativeType & Derivative ) const ITK_OVERRIDE;
 
 protected:
 
   NormalizedCorrelationImageToImageMetricFor3DBLUTFFD();
   virtual ~NormalizedCorrelationImageToImageMetricFor3DBLUTFFD();
-  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
 
 private:
 
@@ -129,7 +129,7 @@ private:
   inline bool GetValueThreadProcessSample( unsigned int threadID,
       unsigned long fixedImageSample,
       const MovingImagePointType & mappedPoint,
-      double movingImageValue ) const;
+      double movingImageValue ) const ITK_OVERRIDE;
 
 
   inline bool GetValueAndDerivativeThreadProcessSample( unsigned int threadID,
@@ -137,7 +137,7 @@ private:
       const MovingImagePointType & mappedPoint,
       double movingImageValue,
       const ImageDerivativesType &
-      movingImageGradientValue ) const;
+      movingImageGradientValue ) const ITK_OVERRIDE;
 
   AccumulateType *m_ThreaderSFF, *m_ThreaderSMM, *m_ThreaderSFM, *m_ThreaderSF, *m_ThreaderSM;
   mutable AccumulateType m_SFF, m_SMM, m_SFM, m_SF, m_SM;
index 1eaa49a2f9ac6096af40dc5dc0ad24f2872b4e7d..e914c1fec5ed56dc9b8939c5766ee6e6d0bd6b3f 100644 (file)
@@ -187,19 +187,19 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
-  virtual void Initialize(void) throw ( ExceptionObject );
+  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
 
   /**  Get the value. */
-  MeasureType GetValue( const ParametersType & parameters ) const;
+  MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const ParametersType & parameters,
-                      DerivativeType & Derivative ) const;
+                      DerivativeType & Derivative ) const ITK_OVERRIDE;
 
   /**  Get the value and derivatives for single valued optimizers. */
   void GetValueAndDerivative( const ParametersType & parameters,
                               MeasureType & Value,
-                              DerivativeType & Derivative ) const;
+                              DerivativeType & Derivative ) const ITK_OVERRIDE;
 
   /** Number of bins to used in the histogram. Typical value is 50. */
   itkSetClampMacro( NumberOfHistogramBins, unsigned long,
@@ -238,7 +238,7 @@ protected:
 
   MattesMutualInformationImageToImageMetricFor3DBLUTFFD();
   virtual ~MattesMutualInformationImageToImageMetricFor3DBLUTFFD();
-  void PrintSelf(std::ostream& os, Indent indent) const;
+  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
 
 private:
 
@@ -330,26 +330,26 @@ private:
 
 
   virtual inline void GetValueThreadPreProcess( unsigned int threadID,
-      bool withinSampleThread ) const;
+      bool withinSampleThread ) const ITK_OVERRIDE;
   virtual inline bool GetValueThreadProcessSample( unsigned int threadID,
       unsigned long fixedImageSample,
       const MovingImagePointType & mappedPoint,
-      double movingImageValue ) const;
+      double movingImageValue ) const ITK_OVERRIDE;
   virtual inline void GetValueThreadPostProcess( unsigned int threadID,
-      bool withinSampleThread ) const;
+      bool withinSampleThread ) const ITK_OVERRIDE;
 
   virtual inline void GetValueAndDerivativeThreadPreProcess(
     unsigned int threadID,
-    bool withinSampleThread ) const;
+    bool withinSampleThread ) const ITK_OVERRIDE;
   virtual inline bool GetValueAndDerivativeThreadProcessSample( unsigned int threadID,
       unsigned long fixedImageSample,
       const MovingImagePointType & mappedPoint,
       double movingImageValue,
       const ImageDerivativesType &
-      movingImageGradientValue ) const;
+      movingImageGradientValue ) const ITK_OVERRIDE;
   virtual inline void GetValueAndDerivativeThreadPostProcess(
     unsigned int threadID,
-    bool withinSampleThread ) const;
+    bool withinSampleThread ) const ITK_OVERRIDE;
 
 };
 
index 949246d4c581b2586eb51ee3862a7b04ec16691f..06ecf29344a77e584ce6e7229bc7ade6df629b27 100644 (file)
@@ -98,25 +98,25 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
-  virtual void Initialize(void) throw ( ExceptionObject );
+  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
 
   /**  Get the value. */
-  MeasureType GetValue( const ParametersType & parameters ) const;
+  MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const ParametersType & parameters,
-                      DerivativeType & Derivative ) const;
+                      DerivativeType & Derivative ) const ITK_OVERRIDE;
 
   /**  Get the value and derivatives for single valued optimizers. */
   void GetValueAndDerivative( const ParametersType & parameters,
                               MeasureType & Value,
-                              DerivativeType & Derivative ) const;
+                              DerivativeType & Derivative ) const ITK_OVERRIDE;
 
 protected:
 
   MeanSquaresImageToImageMetricFor3DBLUTFFD();
   virtual ~MeanSquaresImageToImageMetricFor3DBLUTFFD();
-  void PrintSelf(std::ostream& os, Indent indent) const;
+  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
 
 private:
 
@@ -128,14 +128,14 @@ private:
   inline bool GetValueThreadProcessSample( unsigned int threadID,
       unsigned long fixedImageSample,
       const MovingImagePointType & mappedPoint,
-      double movingImageValue ) const;
+      double movingImageValue ) const ITK_OVERRIDE;
 
   inline bool GetValueAndDerivativeThreadProcessSample( unsigned int threadID,
       unsigned long fixedImageSample,
       const MovingImagePointType & mappedPoint,
       double movingImageValue,
       const ImageDerivativesType &
-      movingImageGradientValue ) const;
+      movingImageGradientValue ) const ITK_OVERRIDE;
 
   MeasureType    * m_ThreaderMSE;
   DerivativeType * m_ThreaderMSEDerivatives;
index fad0b95d1b075c243877494b30f06455f14f4e49..a059e4eff953acd8b59d5bb7c97d36c4da87ad4a 100644 (file)
@@ -1,6 +1,11 @@
 cmake_minimum_required(VERSION 2.8)
 cmake_policy(VERSION 2.8)
 
+
+
+message( FATAL_ERROR "This superbuild is not up to date, do not use." )
+
+
 # set a default build type if it is undefined, then make sure it goes in the cache
 if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
index 0ca5ca91ef91de899b6b0e8dd1175dffd20cce53..515e99a9aef9ecda238d7938e663a0d9f3664822 100644 (file)
@@ -12,6 +12,9 @@ add_library(clitkBinarizeImageLib clitkBinarizeImageGenericFilter.cxx ${clitkBin
 WRAP_GGO(clitkProfileImage_GGO_C clitkProfileImage.ggo)
 add_library(clitkProfileImageLib clitkProfileImageGenericFilter.cxx ${clitkProfileImage_GGO_C})
 
+WRAP_GGO(clitkHistogramImage_GGO_C clitkHistogramImage.ggo)
+add_library(clitkHistogramImageLib clitkHistogramImageGenericFilter.cxx ${clitkHistogramImage_GGO_C})
+
 WRAP_GGO(clitkImageArithm_GGO_C clitkImageArithm.ggo)
 add_library(clitkImageArithmImageLib clitkImageArithmGenericFilter.cxx ${clitkImageArithm_GGO_C})
 
index 554cec75ca33945d80ae6696eda94fab6bccc24c..1f8f3ebaee1408b9652c373658030b666cf4ff53 100644 (file)
@@ -97,9 +97,15 @@ namespace clitk
 
     extractFilter->SetInput(input);
     typename InputImageType::SizeType size;
+    typename OutputImageType::DirectionType direction;
+    direction.SetIdentity();
     for (unsigned int nbDimension=0; nbDimension<Dimension-1; ++nbDimension)
     {
         size[nbDimension] = input->GetLargestPossibleRegion().GetSize(nbDimension);
+        for (unsigned int pixelDim2=0; pixelDim2<Dimension-1; ++pixelDim2)
+        {
+          direction[nbDimension][pixelDim2]=input->GetDirection()[nbDimension][pixelDim2];
+        }
     }
     size[Dimension-1] = 0;
     typename MedianImageType::Pointer tempImage = MedianImageType::New();
@@ -124,7 +130,10 @@ namespace clitk
 
     imageToVectorImageFilter->Update();
 
-    // Output
+    // Copy transform matrix
+    imageToVectorImageFilter->GetOutput()->SetDirection(direction);
+
+    //Output
     writer->SetInput(imageToVectorImageFilter->GetOutput());
     writer->SetFileName(fileName);
     writer->Update();
diff --git a/tools/clitkHistogramImage.cxx b/tools/clitkHistogramImage.cxx
new file mode 100644 (file)
index 0000000..0cb5ac9
--- /dev/null
@@ -0,0 +1,41 @@
+/*=========================================================================
+  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 "clitkHistogramImage_ggo.h"
+#include "clitkHistogramImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkHistogramImage, args_info);
+  CLITK_INIT;
+
+  // Filter
+  typedef clitk::HistogramImageGenericFilter FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  filter->SetArgsInfo(args_info);
+
+  CLITK_TRY_CATCH_EXIT(filter->Update());
+
+  return EXIT_SUCCESS;
+} // This is the end, my friend
+//--------------------------------------------------------------------
diff --git a/tools/clitkHistogramImage.ggo b/tools/clitkHistogramImage.ggo
new file mode 100644 (file)
index 0000000..6689677
--- /dev/null
@@ -0,0 +1,15 @@
+#File clitkHistogramImage.ggo
+package "clitkHistogramImage"
+version "1.0"
+purpose "Save the histogram of the input image in the output text file"
+
+option "config"                -       "Config file"                           string  no
+option "verbose"       v       "Verbose"                                   flag        off
+option "imagetypes" -   "Display allowed image types"   flag   off
+
+option "input"      i   "Input image filename"          string  yes
+option "output"     o   "Output texte filename"         string  yes
+option "size"       s   "size of the bin"               double  no
+
+
+
diff --git a/tools/clitkHistogramImageGenericFilter.cxx b/tools/clitkHistogramImageGenericFilter.cxx
new file mode 100644 (file)
index 0000000..49e3fa0
--- /dev/null
@@ -0,0 +1,165 @@
+/*=========================================================================
+  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 clitkHistogramImageGenericFilter_cxx
+#define clitkHistogramImageGenericFilter_cxx
+
+/* =================================================
+ * @file   clitkHistogramImageGenericFilter.cxx
+ * @author Thomas Baudier <thomas.baudier@creatis.insa-lyon.fr>
+ * @date   22 dec 2015
+ *
+ * @brief
+ *
+ ===================================================*/
+
+#include "clitkHistogramImageGenericFilter.h"
+
+// itk include
+#include <itkImageToHistogramFilter.h>
+#include <itkStatisticsImageFilter.h>
+
+#include <clitkCommon.h>
+
+
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+HistogramImageGenericFilter::HistogramImageGenericFilter():
+  ImageToImageGenericFilter<Self>("HistogramImage")
+{
+  InitializeImageType<2>();
+  InitializeImageType<3>();
+  InitializeImageType<4>();
+  mBinSize = 100;
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<unsigned int Dim>
+void HistogramImageGenericFilter::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+vtkFloatArray* HistogramImageGenericFilter::GetArrayX()
+{
+  return(mArrayX);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+vtkFloatArray* HistogramImageGenericFilter::GetArrayY()
+{
+  return(mArrayY);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+void HistogramImageGenericFilter::SetArgsInfo(const args_info_type & a)
+{
+  mArgsInfo=a;
+  if (mArgsInfo.verbose_given)
+    SetIOVerbose(mArgsInfo.verbose_flag);
+  if (mArgsInfo.imagetypes_given && mArgsInfo.imagetypes_flag)
+    this->PrintAvailableImageTypes();
+
+  if (mArgsInfo.input_given) {
+    SetInputFilename(mArgsInfo.input_arg);
+  }
+  if (mArgsInfo.output_given) {
+    SetOutputFilename(mArgsInfo.output_arg);
+  }
+  if (mArgsInfo.size_given) {
+    SetSizeBin(mArgsInfo.size_arg);
+  }
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+void HistogramImageGenericFilter::SetSizeBin(const double size)
+{
+  mBinSize = size;
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class InputImageType>
+void
+HistogramImageGenericFilter::UpdateWithInputImageType()
+{
+
+  // Reading input
+  typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+  typedef typename InputImageType::PixelType PixelType;
+  typedef typename InputImageType::IndexType IndexType;
+  typedef typename itk::Statistics::ImageToHistogramFilter<InputImageType> HistogramFilterType;
+  typedef typename itk::StatisticsImageFilter<InputImageType> StatisticsImageFilterType;
+
+  //compute range
+  typename StatisticsImageFilterType::Pointer statisticsImageFilter = StatisticsImageFilterType::New ();
+  statisticsImageFilter->SetInput(input);
+  statisticsImageFilter->Update();
+  double range = statisticsImageFilter->GetMaximum() - statisticsImageFilter->GetMinimum();
+  //compute bin number
+  typedef typename HistogramFilterType::HistogramSizeType SizeType;
+  SizeType binNumber(1);
+  mBinSize = std::log(range);
+  binNumber[0] = (int)(range/mBinSize);
+  if (binNumber[0] == 0)
+    binNumber[0] = 1;
+
+  //compute histogram
+  typename HistogramFilterType::Pointer histogramFilter = HistogramFilterType::New();
+  histogramFilter->SetHistogramSize(binNumber);
+  histogramFilter->SetAutoMinimumMaximum(true);
+  typename HistogramFilterType::HistogramMeasurementVectorType lowerBound(1);
+  typename HistogramFilterType::HistogramMeasurementVectorType upperBound(1);
+  lowerBound[0] = statisticsImageFilter->GetMinimum();
+  upperBound[0] = statisticsImageFilter->GetMaximum();
+  histogramFilter->SetHistogramBinMinimum(lowerBound);
+  histogramFilter->SetHistogramBinMaximum(upperBound);
+  histogramFilter->SetInput(input);
+  histogramFilter->Update();
+
+  mArrayX = vtkSmartPointer<vtkFloatArray>::New();
+  mArrayY = vtkSmartPointer<vtkFloatArray>::New();
+
+  for(unsigned int i = 0; i < histogramFilter->GetOutput()->GetSize()[0]; ++i)
+  {
+    mArrayY->InsertNextTuple1(histogramFilter->GetOutput()->GetFrequency(i));
+    mArrayX->InsertNextTuple1(statisticsImageFilter->GetMinimum() + (i+0.5)*mBinSize);
+  }
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif  //#define clitkHistogramImageGenericFilter_cxx
diff --git a/tools/clitkHistogramImageGenericFilter.h b/tools/clitkHistogramImageGenericFilter.h
new file mode 100644 (file)
index 0000000..d963fbc
--- /dev/null
@@ -0,0 +1,79 @@
+/*=========================================================================
+  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 clitkHistogramImageGenericFilter_h
+#define clitkHistogramImageGenericFilter_h
+
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+#include "clitkHistogramImage_ggo.h"
+
+#include <vtkIntArray.h>
+#include <vtkFloatArray.h>
+#include <itkHistogram.h>
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+  class ITK_EXPORT HistogramImageGenericFilter:
+    public ImageToImageGenericFilter<HistogramImageGenericFilter>
+  {
+
+  public:
+    //--------------------------------------------------------------------
+    typedef HistogramImageGenericFilter         Self;
+    typedef itk::SmartPointer<Self>           Pointer;
+    typedef itk::SmartPointer<const Self>     ConstPointer;
+    typedef args_info_clitkHistogramImage       args_info_type;
+
+    //--------------------------------------------------------------------
+    // Method for creation through the object factory
+    // and Run-time type information (and related methods)
+    itkNewMacro(Self);  
+    itkTypeMacro(HistogramImageGenericFilter, LightObject);
+
+    //--------------------------------------------------------------------
+    void SetArgsInfo(const args_info_type & a);
+    void SetSizeBin (const double size);
+
+    //--------------------------------------------------------------------
+    // Main function called each time the filter is updated
+    template<class InputImageType>  
+    void UpdateWithInputImageType();
+
+    vtkFloatArray* GetArrayX();
+    vtkFloatArray* GetArrayY();
+
+  protected:
+    HistogramImageGenericFilter();
+    template<unsigned int Dim> void InitializeImageType();
+    args_info_type mArgsInfo;
+    
+    double mBinSize;
+    
+    vtkSmartPointer<vtkFloatArray> mArrayX;
+    vtkSmartPointer<vtkFloatArray> mArrayY;
+
+  }; // end class
+  //--------------------------------------------------------------------
+
+} // end namespace clitk
+//--------------------------------------------------------------------
+
+#endif // #define clitkHistogramImageGenericFilter_h
index 81386821e37e62d4725748729f7f9a5883fcd66b..e54c736d99ae1d9e433204931ebb0c4f7533c9d3 100644 (file)
@@ -68,6 +68,7 @@ int main(int argc, char * argv[])
   filter->SetIOVerbose(args_info.verbose_flag);
   filter->SetOutputFilename(output);
   filter->SetVV(args_info.vv_flag);
+  filter->SetNoNiiMeta(args_info.noniimeta_flag);
   filter->SetCorrectNegativeSpacingFlag(args_info.correct_flag);
   filter->EnableWriteCompression(args_info.compression_flag);
   if (args_info.type_given) filter->SetOutputPixelType(args_info.type_arg);
index 6d74318e776a08770c2be3ac0ab4bbeba04a40d4..2304d50876ff0423cea4af9aadf49a54883bfa78 100644 (file)
@@ -3,11 +3,12 @@ package "clitkImageConvert"
 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 "input"       i "Input image filename"                                       string no
-option "output"      o "Output image filename"                                      string no
-option "type"        t "Output type (float, ushort ...)"                            string no
-option "verbose"     v "Verbose"                                                    flag   off
-option "compression" c "Compress output"                                            flag   off
-option "vv"          - "Read image as in vv and save transform in meta information" flag   off
-option "correct"     - "Correct dicom with negative Z spacing"                      flag   off
+option "config"      - "Config file"                                                   string no
+option "input"       i "Input image filename"                                          string no
+option "output"      o "Output image filename"                                         string no
+option "type"        t "Output type (float, ushort ...)"                               string no
+option "verbose"     v "Verbose"                                                       flag   off
+option "compression" c "Compress output"                                               flag   off
+option "vv"          - "Read image as in vv and save transform in meta information"    flag   off
+option "correct"     - "Correct dicom with negative Z spacing"                         flag   off
+option "noniimeta"   - "Multiply 1st and 2nd coordinate of Direction and Origin by -1" flag   off
index a1b28c22014d14606902cd338ceb908170edd331..1e95a7bb53ca9e29408850e90cb4c5bd82ff877f 100644 (file)
@@ -24,6 +24,7 @@
 #include "vvImageWriter.h"
 #include "itkFlipImageFilter.h"
 #include "itkGDCMImageIO.h"
+#include <itkChangeInformationImageFilter.h>
 
 #include "gdcmReader.h"
 #include "gdcmAttribute.h"
@@ -172,8 +173,26 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType()
       itk::MetaDataDictionary dict;// = new itk::MetaDataDictionary;
       input->SetMetaDataDictionary(dict);
     }
-    this->SetNextOutput<InputImageType>(input);
 
+    typedef itk::ChangeInformationImageFilter<InputImageType> CIType;
+    typename CIType::Pointer changeInfo = CIType::New();
+    if(mNoNiiMeta) {
+      changeInfo->SetInput(input);
+      typename CIType::PointType o = input->GetOrigin();
+      o[0] *= -1.;
+      o[1] *= -1.;
+      typename CIType::DirectionType d = input->GetDirection();
+      d[0][0] *= -1.;
+      d[1][1] *= -1.;
+      changeInfo->ChangeDirectionOn();
+      changeInfo->ChangeOriginOn();
+      changeInfo->SetOutputOrigin(o);
+      changeInfo->SetOutputDirection(d);
+      changeInfo->Update();
+      input = changeInfo->GetOutput();
+    }
+
+    this->SetNextOutput<InputImageType>(input);
 
   } else {
     // "trick" to call independent versions of update according to the
index aa8b2ba64b69496ee2580bc77f3ef3383bd5542b..4f1a10031db0123b4ec7295f0ae19b6fe7dd98f5 100644 (file)
@@ -74,6 +74,7 @@ namespace clitk {
     std::string GetOutputPixelTypeName() { return mOutputPixelTypeName; }
     void SetOutputPixelType(std::string p) { mOutputPixelTypeName = p; }
     void SetVV(bool b) { mVV = b; }
+    void SetNoNiiMeta(bool b) { mNoNiiMeta = b; }
     bool IsWarningOccur() { return mWarningOccur; }
     std::string & GetWarning() { return mWarning; }
     void EnableDisplayWarning(bool b) { mDisplayWarning = b; }
@@ -95,6 +96,7 @@ namespace clitk {
     bool mWarningOccur;
     bool mDisplayWarning;
     bool mVV;
+    bool mNoNiiMeta;
     bool mCorrectNegativeSpacingFlag;
 
   private:
index ab2bec514673ced6d5f1313d3477dfa94015feda..d84bbb51400c0d4a7fbfd45091baead16f4d4ce8 100644 (file)
 #include "clitkIO.h"
 
 template<class ImageType>
-void NewFilledImage(int * size, float * spacing, double * origin,
+void NewFilledImage(int * size, float * spacing, double * origin, double * direction,
                     double value,typename ImageType::Pointer output)
 {
   static const unsigned int Dim = ImageType::GetImageDimension();
+
   typename ImageType::SizeType mSize;
   mSize.Fill (0);
   for(unsigned int i=0; i<Dim; i++) mSize[i] = size[i];
+
   typename ImageType::RegionType mRegion;
   mRegion.SetSize(mSize);
+
   typename ImageType::SpacingType mSpacing;
   for(unsigned int i=0; i<Dim; i++) mSpacing[i] = spacing[i];
+
+  typename ImageType::DirectionType directionImage;
+  for(unsigned int i=0; i<Dim; i++)
+    for(unsigned int j=0; j<Dim; j++)
+      directionImage[i][j] = direction[i*Dim+j];
+
   output->SetRegions(mRegion);
   output->SetSpacing(mSpacing);
+  output->SetDirection(directionImage);
   output->Allocate();
+
   typename ImageType::PointType mOrigin;
   for(unsigned int i=0; i<Dim; i++) mOrigin[i] = origin[i];
   output->SetOrigin(mOrigin);
+
   typedef typename ImageType::PixelType PixelType;
   PixelType p = clitk::PixelTypeDownCast<double, PixelType>(value);
   output->FillBuffer(p);
@@ -75,11 +87,15 @@ int main(int argc, char * argv[])
     args_info.spacing_arg = new float[dim];
     args_info.origin_given = dim;
     args_info.origin_arg = new double[dim];
+    args_info.transformMatrix_given = dim*dim;
+    args_info.transformMatrix_arg = new double[dim*dim];
 
     for(int i=0; i<dim; i++) {
       args_info.size_arg[i] = header->GetDimensions(i);
       args_info.spacing_arg[i] = header->GetSpacing(i);
       args_info.origin_arg[i]=   header->GetOrigin(i);
+      for (int j=0; j<dim; ++j)
+        args_info.transformMatrix_arg[i*dim+j] = header->GetDirection(i)[j];
     }
   }
 
@@ -119,27 +135,50 @@ int main(int argc, char * argv[])
     for(int i=0; i<dim; i++) spacing[i] = args_info.spacing_arg[i];
   }
 
+  // direction
+  std::vector<double> direction;
+  direction.resize(dim*dim);
+  for(int i=0; i<dim; i++)
+  {
+    for(int j=0; j<dim; j++)
+    {
+      if (i == j)
+        direction[i*dim+j] = 1;
+      else
+        direction[i*dim+j] = 0;
+    }
+  }
+  if (args_info.transformMatrix_given) {
+    if (args_info.transformMatrix_given != dim*dim) {
+      std::cerr << "ERROR : please give the same number of values for --transfomMatrix and --spacing." << std::endl;
+      exit(-1);
+    }
+    for(int i=0; i<dim; i++)
+      for(int j=0; j<dim; j++)
+        direction[i*dim+j] = args_info.transformMatrix_arg[i*dim+j];
+  }
+
   // Create new image
   typedef float PixelType;
   if (dim == 2) {
     const int Dim=2;
     typedef itk::Image<PixelType, Dim> ImageType;
     ImageType::Pointer output = ImageType::New();
-    NewFilledImage<ImageType>(args_info.size_arg, &spacing[0], &origin[0], args_info.value_arg, output);
+    NewFilledImage<ImageType>(args_info.size_arg, &spacing[0], &origin[0], &direction[0], args_info.value_arg, output);
     clitk::writeImage<ImageType>(output, args_info.output_arg);
   }
   if (dim == 3) {
     const int Dim=3;
     typedef itk::Image<PixelType, Dim> ImageType;
     ImageType::Pointer output = ImageType::New();
-    NewFilledImage<ImageType>(args_info.size_arg, &spacing[0], &origin[0], args_info.value_arg, output);
+    NewFilledImage<ImageType>(args_info.size_arg, &spacing[0], &origin[0], &direction[0], args_info.value_arg, output);
     clitk::writeImage<ImageType>(output, args_info.output_arg);
   }
   if (dim == 4) {
     const int Dim=4;
     typedef itk::Image<PixelType, Dim> ImageType;
     ImageType::Pointer output = ImageType::New();
-    NewFilledImage<ImageType>(args_info.size_arg, &spacing[0], &origin[0], args_info.value_arg, output);
+    NewFilledImage<ImageType>(args_info.size_arg, &spacing[0], &origin[0], &direction[0], args_info.value_arg, output);
     clitk::writeImage<ImageType>(output, args_info.output_arg);
   }
 
index f197de74b44d3beb1262fa383fc5f458aff00d47..391801d346d925911ed78c75d764fb14a5ff159b 100644 (file)
@@ -11,6 +11,7 @@ option "like"         l "Size/spacing like this other image" string no
 option "size"          - "Number of pixels of each coordinate" int     no multiple
 option "spacing"       - "Spacing in mm between pixels"        float   no multiple
 option "origin"                - "Origin in mm"                        double  no multiple
+option "transformMatrix" - "Rotation matrix" double no multiple
 
 option "value"         - "Value for all voxels"  float  default="0.0"  no
 option "verbose"       v "Verbose"               flag   off
index 06d5792566198e8888c753461f254de72775c595..1ea44362f08a6de6d35bb648df5d68279d73dcd9 100644 (file)
@@ -103,17 +103,24 @@ namespace clitk
     spacing.Fill(1);
     typename OutputImageType::PointType origin;
     origin.Fill(0);
+    typename OutputImageType::DirectionType direction;
+    direction.SetIdentity();
     for (unsigned int pixelDim=0; pixelDim<Dimension; ++pixelDim)
     {
       size[pixelDim]=adaptor->GetLargestPossibleRegion().GetSize(pixelDim);
       spacing[pixelDim]=input->GetSpacing()[pixelDim];
       origin[pixelDim]=input->GetOrigin()[pixelDim];
+      for (unsigned int pixelDim2=0; pixelDim2<Dimension; ++pixelDim2)
+      {
+        direction[pixelDim][pixelDim2]=input->GetDirection()[pixelDim][pixelDim2];
+      }
     }
     typename OutputImageType::RegionType region;
     region.SetSize(size);
     region.SetIndex(index);    
     output->SetRegions(region);
     output->SetOrigin(origin);
+    output->SetDirection(direction);
     output->SetSpacing(spacing);
     output->Allocate();
     writer->SetInput(output);
index 773790dcf0a13a195bd813d238d89a51734af086..9f3f443bc596e40a858078523d23e236de35c0c4 100644 (file)
@@ -9,8 +9,8 @@ option "imagetypes" -   "Display allowed image types"   flag    off
 
 option "input"      i   "Input image filename"          string  yes
 option "output"     o   "Output texte filename"         string  yes
-option "point1"     f   "First point (mm)"              double     yes multiple(-4)
-option "point2"     s   "Second point (mm)"             double     yes multiple(-4)
+option "point1"     f   "First point (vox)"              double     yes multiple(-4)
+option "point2"     s   "Second point (vox)"             double     yes multiple(-4)
 
 
 
index 02394d3ca60231943e534a5d036dcf0911cd224a..6c81756fbcf7adf9a3f51bfa0ad7fd753a73431f 100644 (file)
@@ -120,6 +120,9 @@ ProfileImageGenericFilter::UpdateWithInputImageType()
   mArrayY = vtkSmartPointer<vtkFloatArray>::New();
   mCoord = vtkSmartPointer<vtkFloatArray>::New();
   mCoord->SetNumberOfComponents(InputImageType::ImageDimension);
+  mCoordmm = vtkSmartPointer<vtkFloatArray>::New();
+  mCoordmm->SetNumberOfComponents(InputImageType::ImageDimension);
+  mDimension = InputImageType::ImageDimension;
   
   /*typename InputImageType::Pointer outputImage;
   outputImage = InputImageType::New();
@@ -162,11 +165,20 @@ ProfileImageGenericFilter::UpdateWithInputImageType()
     // Fill in the table the distance value
     mArrayX->InsertNextTuple1(distance);
     
-    // Fille in the table the voxel coordinate value
-    mCoord->InsertNextTuple(tuple);
+    // Fill in the table the voxel coordinate value
+    mCoord->InsertNextTuple(tuple); //index
+    for (int i=0; i<InputImageType::ImageDimension; ++i) {
+        tuple[i] = transformedCurrentPoint[i];
+    }
+    mCoordmm->InsertNextTuple(tuple); //mm
     ++lineNumber;
     ++itProfile;
   }
+
+  if (mArgsInfo.output_given) {
+    std::string str(mArgsInfo.output_arg);
+    this->WriteOutput(str);
+  }
   
   /*
   itk::LineIterator<InputImageType> otProfile(outputImage, pointBegin, pointEnd);
@@ -184,6 +196,58 @@ ProfileImageGenericFilter::UpdateWithInputImageType()
 //--------------------------------------------------------------------
 
 
+//--------------------------------------------------------------------
+void ProfileImageGenericFilter::WriteOutput(std::string outputFilename)
+{
+  ofstream fileOpen(outputFilename.c_str(), std::ofstream::trunc);
+
+  if(!fileOpen) {
+      cerr << "Error during saving" << endl;
+      return;
+  }
+
+  double *tuple;
+  tuple = new double[mDimension];
+  int i(0);
+  fileOpen << "The Bresenham algorithm is used to travel along the line. Values represent the center of each crossed voxel (in voxel and mm)" << endl;
+  fileOpen << "Id" << "\t" << "Value" << "\t" ;
+  fileOpen << "x(vox)" << "\t" << "y(vox)" << "\t";
+  if (mDimension >=3)
+      fileOpen << "z(vox)" << "\t";
+  if (mDimension >=4)
+      fileOpen << "t" << "\t";
+  fileOpen << "x(mm)" << "\t" << "y(mm)" << "\t";
+  if (mDimension >=3)
+      fileOpen << "z(mm)" << "\t";
+  if (mDimension >=4)
+      fileOpen << "t" << "\t";
+  fileOpen << endl;
+
+  while (i<mArrayX->GetNumberOfTuples()) {
+      fileOpen << i << "\t" << mArrayY->GetTuple(i)[0] << "\t" ;
+
+      mCoord->GetTuple(i, tuple);
+      for (int j=0; j<mDimension ; ++j) {
+          fileOpen << tuple[j] << "\t" ;
+      }
+      mCoordmm->GetTuple(i, tuple);
+      for (int j=0; j<mDimension ; ++j) {
+          fileOpen << tuple[j] << "\t" ;
+      }
+      if (mDimension == 4) {
+          fileOpen << tuple[3] << "\t" ;
+      }
+      fileOpen << endl;
+      ++i;
+  }
+
+  delete [] tuple;
+
+  fileOpen.close();
+}
+//--------------------------------------------------------------------
+
+
 }//end clitk
 
 #endif  //#define clitkProfileImageGenericFilter_cxx
index 573a41ca62b2a487908565ec9069f51574d1de0b..e22ed74206018bac0dad4f8d67d66f2512813daa 100644 (file)
@@ -23,7 +23,6 @@
 #include "clitkImageToImageGenericFilter.h"
 #include "clitkProfileImage_ggo.h"
 
-#include <vtkIntArray.h>
 #include <vtkFloatArray.h>
 
 //--------------------------------------------------------------------
@@ -59,6 +58,9 @@ namespace clitk
     vtkFloatArray* GetArrayY();
     vtkFloatArray* GetCoord();
 
+    //Write the output in the txt file
+    void WriteOutput(std::string outputFilename);
+
   protected:
     ProfileImageGenericFilter();
     template<unsigned int Dim> void InitializeImageType();
@@ -68,6 +70,8 @@ namespace clitk
     vtkSmartPointer<vtkFloatArray> mArrayX;
     vtkSmartPointer<vtkFloatArray> mArrayY;
     vtkSmartPointer<vtkFloatArray> mCoord;
+    vtkSmartPointer<vtkFloatArray> mCoordmm;
+    int mDimension;
     
     
   }; // end class
index 4eb00b9bac7d4b880e0ac77f7883e3ab6f9a8346..a73d3080e359d06eb462b26b589d32974b789334 100644 (file)
@@ -25,6 +25,7 @@
  -------------------------------------------------------------------*/
 
 #include "clitkSplitImageGenericFilter.h"
+#include "itkChangeInformationImageFilter.h"
 #include <itkIntensityWindowingImageFilter.h>
 //--------------------------------------------------------------------
 clitk::SplitImageGenericFilter::SplitImageGenericFilter():
@@ -109,6 +110,8 @@ void clitk::SplitImageGenericFilter::UpdateWithInputImageType()
   filter->SetExtractionRegion(extracted_region);
   filter->Update();
 
+  typedef itk::ChangeInformationImageFilter< OutputImageType > InformationFilterType;
+
   typename ImageType::IndexType index=input->GetLargestPossibleRegion().GetIndex();
   std::string base_filename=GetOutputFilename();
   unsigned int number_of_output_images=input->GetLargestPossibleRegion().GetSize()[mSplitDimension];
@@ -119,16 +122,44 @@ void clitk::SplitImageGenericFilter::UpdateWithInputImageType()
     extracted_region.SetIndex(index);
     filter->SetExtractionRegion(extracted_region);
     filter->Update();
-    if(this->m_Png){
-      PngConversion<OutputImageType> png;
-      SetOutputFilename(base_filename+"_"+ss.str()+".png");
-      typename PngConversion<OutputImageType>::OutputPngImagePointer output;
-      output = png.Do(this->m_Window, this->m_Level, filter->GetOutput());
-      this->template SetNextOutput<typename PngConversion<OutputImageType>::OutputPngImageType>(output);
+
+    if (ImageType::ImageDimension == 4 && mSplitDimension == 3) //Copy the transformation matrix if the original image is a 4D image splitted along the time dimension
+    {
+      typename InformationFilterType::Pointer informationFilter = InformationFilterType::New();
+      informationFilter->SetInput( filter->GetOutput() );
+      typename OutputImageType::DirectionType directionOutput;
+      for (unsigned j=0; j<3; ++j)
+        for (unsigned k=0; k<3; ++k)
+          directionOutput[j][k] = input->GetDirection()[j][k];
+      informationFilter->SetOutputDirection( directionOutput );
+      informationFilter->ChangeDirectionOn();
+      informationFilter->UpdateOutputInformation();
+
+      if(this->m_Png){
+        PngConversion<OutputImageType> png;
+        SetOutputFilename(base_filename+"_"+ss.str()+".png");
+        typename PngConversion<OutputImageType>::OutputPngImagePointer output;
+        output = png.Do(this->m_Window, this->m_Level, informationFilter->GetOutput());
+        this->template SetNextOutput<typename PngConversion<OutputImageType>::OutputPngImageType>(output);
+      }
+      else {
+        SetOutputFilename(base_filename+"_"+ss.str()+".mhd");
+        SetNextOutput<OutputImageType>(informationFilter->GetOutput());
+      }
     }
-    else {
-      SetOutputFilename(base_filename+"_"+ss.str()+".mhd");
-      SetNextOutput<OutputImageType>(filter->GetOutput());
+    else
+    {
+      if(this->m_Png){
+        PngConversion<OutputImageType> png;
+        SetOutputFilename(base_filename+"_"+ss.str()+".png");
+        typename PngConversion<OutputImageType>::OutputPngImagePointer output;
+        output = png.Do(this->m_Window, this->m_Level, filter->GetOutput());
+        this->template SetNextOutput<typename PngConversion<OutputImageType>::OutputPngImageType>(output);
+      }
+      else {
+        SetOutputFilename(base_filename+"_"+ss.str()+".mhd");
+        SetNextOutput<OutputImageType>(filter->GetOutput());
+      }
     }
   }
 }
index d1d1f714f3a76b46978fd0e9f3335740c1006a2c..84bfbaaec7148cc5f133180c3b5290ca608eb491 100644 (file)
@@ -132,6 +132,7 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType()
     resampler =itk::VectorResampleImageFilter<DeformationFieldType, DeformationFieldType >::New();
     resampler->SetInput(deformationField);
     resampler->SetOutputSpacing(deformationField->GetSpacing());
+    resampler->SetOutputDirection(deformationField->GetDirection());
     resampler->SetSize(newSize);
     resampler->SetOutputOrigin(input->GetOrigin());
     resampler->SetInterpolator(genericInterpolator->GetInterpolatorPointer());
@@ -163,6 +164,7 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType()
     resampler =itk::VectorResampleImageFilter<DeformationFieldType, DeformationFieldType >::New();
     resampler->SetInput(deformationField);
     resampler->SetOutputSpacing(input->GetSpacing());
+    resampler->SetOutputDirection(deformationField->GetDirection());
     resampler->SetSize(newSize);
     resampler->SetOutputOrigin(input->GetOrigin());
     resampler->SetInterpolator(genericInterpolator->GetInterpolatorPointer());
@@ -210,6 +212,7 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType()
     backwardWarpFilter->SetOutputSpacing( deformationField->GetSpacing() );
     backwardWarpFilter->SetOutputOrigin( input->GetOrigin() );
     backwardWarpFilter->SetOutputSize( deformationField->GetLargestPossibleRegion().GetSize() );
+    backwardWarpFilter->SetOutputDirection( input->GetDirection() );
     typename itk::VectorResampleImageFilter<DeformationFieldType, DeformationFieldType >::Pointer
     resampler =itk::VectorResampleImageFilter<DeformationFieldType, DeformationFieldType >::New();
     backwardWarpFilter->SetInterpolator(genericInterpolator->GetInterpolatorPointer());
index 5bcc4c03a872571895b1b431d0082e448ee5917c..ee0fc2597572630ad1611bf70e6c80fe889fce11 100755 (executable)
@@ -3,12 +3,22 @@ set -ev
 MAKE="make --jobs=$NUM_THREADS --keep-going"
 
 #Prepare cmake arguments following the ITK version
-if [ "$ITK_VERSION" == "4.5" ]; then
-itk_repo_str=" --branch v4.5.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
-cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DModule_ITKReview=ON -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 -DModule_ITKReview=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
+if [ "$C11" == "true" ]; then
+  if [ "$ITK_VERSION" == "4.5" ]; then
+    itk_repo_str=" --branch v4.5.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 -DModule_ITKReview=ON -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 -DModule_ITKReview=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
+  fi
+else
+  if [ "$ITK_VERSION" == "4.5" ]; then
+    itk_repo_str=" --branch v4.5.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1"
+    cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DModule_ITKReview=ON -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 -DModule_ITKReview=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF "
+  fi
 fi
 
 if [ -d $ITK_SOURCE_DIR ]; then
index 455eb73e3eda55320375a1d9865c5b707a58a96f..7b3ef0bb54c84814040528014b82b19d05f79dc6 100755 (executable)
@@ -5,8 +5,10 @@ set -ev
 if [ "$QT_VERSION" == "4.8.7" ]; then
   if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt4-dev-tools; fi
   
-  if test $TRAVIS_OS_NAME == osx ; then brew install cartr/qt4/qt; fi
-  if test $TRAVIS_OS_NAME == osx ; then brew link qt --force; fi
+  if test $TRAVIS_OS_NAME == osx ; then brew install cartr/qt4/qt@4; fi
+  if test $TRAVIS_OS_NAME == osx ; then brew install cartr/qt4/qt-webkit@2.3; fi
+  if test $TRAVIS_OS_NAME == osx ; then brew link qt@4 --force; fi
+  if test $TRAVIS_OS_NAME == osx ; then brew link qt-webkit@2.3 --force; fi
   if test $TRAVIS_OS_NAME == osx ; then qmake -v; fi
 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
index f7b1fce56d102385b1cdf1bd1f29695f4c074d02..f4dbf32532edc1766cabc8ada6d2ff99a86cf66f 100755 (executable)
@@ -9,61 +9,123 @@ elif [ "$QT_VERSION" == "5.5.1" ]; then
 fi
 
 #Prepare cmake arguments following the VTK version
-if [ "$VTK_VERSION" == "5.10" ]; then
-vtk_repo_str=" --branch v5.10.0 https://github.com/Kitware/VTK.git --depth 1"
-cmake_arg_str=" $cmake_arg_str 
-  -DBUILD_SHARED_LIBS=1
-  -DCMAKE_BUILD_TYPE=Release
-  -DBUILD_TESTING=0
-  -DBUILD_EXAMPLES=0
-  -DBUILD_DOCUMENTATION=0
-  -DVTK_USE_QT=ON
-  -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"
-cmake_arg_str=" $cmake_arg_str 
-  -DBUILD_SHARED_LIBS=1
-  -DCMAKE_BUILD_TYPE=Release
-  -DBUILD_TESTING=0
-  -DBUILD_EXAMPLES=0
-  -DBUILD_DOCUMENTATION=0
-  -DVTK_Group_StandAlone=ON
-  -DVTK_Group_Imaging=OFF
-  -DVTK_Group_MPI=OFF
-  -DVTK_Group_Rendering=ON
-  -DVTK_Group_Tk=OFF
-  -DVTK_Group_Views=OFF
-  -DVTK_Group_Web=OFF
-  -DModule_vtkGUISupportQt=ON
-  -DModule_vtkGUISupportQtOpenGL=ON
-  -DModule_vtkGUISupportQtSQL=ON
-  -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"
-cmake_arg_str=" $cmake_arg_str
-  -DBUILD_SHARED_LIBS=1
-  -DCMAKE_BUILD_TYPE=Release
-  -DBUILD_TESTING=0
-  -DBUILD_EXAMPLES=0
-  -DBUILD_DOCUMENTATION=0
-  -DVTK_Group_StandAlone=ON
-  -DVTK_Group_Imaging=OFF
-  -DVTK_Group_MPI=OFF
-  -DVTK_Group_Rendering=ON
-  -DVTK_Group_Tk=OFF
-  -DVTK_Group_Views=OFF
-  -DVTK_Group_Web=OFF
-  -DVTK_RENDERING_BACKEND=OpenGL
-  -DModule_vtkGUISupportQt=ON
-  -DModule_vtkGUISupportQtOpenGL=ON
-  -DModule_vtkGUISupportQtSQL=ON
-  -DModule_vtkRenderingQt=ON
-  -DModule_vtkViewsQt=ON
-  -DVTK_QT_VERSION="$QT_MAJOR_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"
+  cmake_arg_str=" $cmake_arg_str
+    -DCMAKE_CXX_FLAGS=-std=c++11
+    -DBUILD_SHARED_LIBS=1
+    -DCMAKE_BUILD_TYPE=Release
+    -DBUILD_TESTING=0
+    -DBUILD_EXAMPLES=0
+    -DBUILD_DOCUMENTATION=0
+    -DVTK_USE_QT=ON
+    -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"
+  cmake_arg_str=" $cmake_arg_str
+    -DCMAKE_CXX_FLAGS=-std=c++11
+    -DBUILD_SHARED_LIBS=1
+    -DCMAKE_BUILD_TYPE=Release
+    -DBUILD_TESTING=0
+    -DBUILD_EXAMPLES=0
+    -DBUILD_DOCUMENTATION=0
+    -DVTK_Group_StandAlone=ON
+    -DVTK_Group_Imaging=OFF
+    -DVTK_Group_MPI=OFF
+    -DVTK_Group_Rendering=ON
+    -DVTK_Group_Tk=OFF
+    -DVTK_Group_Views=OFF
+    -DVTK_Group_Web=OFF
+    -DModule_vtkGUISupportQt=ON
+    -DModule_vtkGUISupportQtOpenGL=ON
+    -DModule_vtkGUISupportQtSQL=ON
+    -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"
+  cmake_arg_str=" $cmake_arg_str
+    -DCMAKE_CXX_FLAGS=-std=c++11
+    -DBUILD_SHARED_LIBS=1
+    -DCMAKE_BUILD_TYPE=Release
+    -DBUILD_TESTING=0
+    -DBUILD_EXAMPLES=0
+    -DBUILD_DOCUMENTATION=0
+    -DVTK_Group_StandAlone=ON
+    -DVTK_Group_Imaging=OFF
+    -DVTK_Group_MPI=OFF
+    -DVTK_Group_Rendering=ON
+    -DVTK_Group_Tk=OFF
+    -DVTK_Group_Views=OFF
+    -DVTK_Group_Web=OFF
+    -DVTK_RENDERING_BACKEND=OpenGL
+    -DModule_vtkGUISupportQt=ON
+    -DModule_vtkGUISupportQtOpenGL=ON
+    -DModule_vtkGUISupportQtSQL=ON
+    -DModule_vtkRenderingQt=ON
+    -DModule_vtkViewsQt=ON
+    -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"
+  cmake_arg_str=" $cmake_arg_str
+    -DBUILD_SHARED_LIBS=1
+    -DCMAKE_BUILD_TYPE=Release
+    -DBUILD_TESTING=0
+    -DBUILD_EXAMPLES=0
+    -DBUILD_DOCUMENTATION=0
+    -DVTK_USE_QT=ON
+    -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"
+  cmake_arg_str=" $cmake_arg_str
+    -DBUILD_SHARED_LIBS=1
+    -DCMAKE_BUILD_TYPE=Release
+    -DBUILD_TESTING=0
+    -DBUILD_EXAMPLES=0
+    -DBUILD_DOCUMENTATION=0
+    -DVTK_Group_StandAlone=ON
+    -DVTK_Group_Imaging=OFF
+    -DVTK_Group_MPI=OFF
+    -DVTK_Group_Rendering=ON
+    -DVTK_Group_Tk=OFF
+    -DVTK_Group_Views=OFF
+    -DVTK_Group_Web=OFF
+    -DModule_vtkGUISupportQt=ON
+    -DModule_vtkGUISupportQtOpenGL=ON
+    -DModule_vtkGUISupportQtSQL=ON
+    -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"
+  cmake_arg_str=" $cmake_arg_str
+    -DBUILD_SHARED_LIBS=1
+    -DCMAKE_BUILD_TYPE=Release
+    -DBUILD_TESTING=0
+    -DBUILD_EXAMPLES=0
+    -DBUILD_DOCUMENTATION=0
+    -DVTK_Group_StandAlone=ON
+    -DVTK_Group_Imaging=OFF
+    -DVTK_Group_MPI=OFF
+    -DVTK_Group_Rendering=ON
+    -DVTK_Group_Tk=OFF
+    -DVTK_Group_Views=OFF
+    -DVTK_Group_Web=OFF
+    -DVTK_RENDERING_BACKEND=OpenGL
+    -DModule_vtkGUISupportQt=ON
+    -DModule_vtkGUISupportQtOpenGL=ON
+    -DModule_vtkGUISupportQtSQL=ON
+    -DModule_vtkRenderingQt=ON
+    -DModule_vtkViewsQt=ON
+    -DVTK_QT_VERSION="$QT_MAJOR_VERSION" "
+  fi
 fi
 
 if [ -d $VTK_SOURCE_DIR ]; then
index 797b03cc7077d6568d342fafbf8b0f6dcd46d049..54720764e6cd7a44b8b7c60e2914e47117feb319 100755 (executable)
@@ -3,11 +3,20 @@ set -ev
 MAKE="make --jobs=$NUM_THREADS --keep-going"
 
 #Prepare cmake arguments following the vv version
-cmake_arg_str=" -DCLITK_BUILD_REGISTRATION=OFF
--DCLITK_BUILD_SEGMENTATION=OFF
--DCLITK_BUILD_TOOLS=OFF
--DCLITK_BUILD_VV=ON
--DCLITK_EXPERIMENTAL=OFF"
+if [ "$C11" == "true" ]; then
+  cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11
+  -DCLITK_BUILD_REGISTRATION=OFF
+  -DCLITK_BUILD_SEGMENTATION=OFF
+  -DCLITK_BUILD_TOOLS=OFF
+  -DCLITK_BUILD_VV=ON
+  -DCLITK_EXPERIMENTAL=OFF"
+else
+  cmake_arg_str=" -DCLITK_BUILD_REGISTRATION=OFF
+  -DCLITK_BUILD_SEGMENTATION=OFF
+  -DCLITK_BUILD_TOOLS=OFF
+  -DCLITK_BUILD_VV=ON
+  -DCLITK_EXPERIMENTAL=OFF"
+fi
 
 #CMAKE and MAKE
 mkdir -p $BUILD_DIR
index 14b441ee0d752656c17647ef4522cf63593b8db4..436dfc64449e004af7fa4a11f8c8a04f3bcd2994 100644 (file)
@@ -22,6 +22,7 @@ set(vv_TOOLS
   vvToolROIManager
   vvToolSegmentation
   vvToolProfile
+  vvToolHistogram
   ## these ones are for tests (not working)
   # vvToolTest
   # vvToolFoo
@@ -38,6 +39,7 @@ set(vv_TOOLS
 #  >> add the relevant $_LIBS variable to the tool that has dependencies?
 set(vvToolBinarize_LIBS clitkBinarizeImageLib)
 set(vvToolProfile_LIBS clitkProfileImageLib)
+set(vvToolHistogram_LIBS clitkHistogramImageLib)
 set(vvToolResample_LIBS clitkResampleImageLib)
 set(vvToolConvert_LIBS clitkImageConvertLib)
 set(vvToolExtractPatient_LIBS clitkSegmentationGgoLib)
@@ -89,6 +91,7 @@ set(vv_SRCS
   vvGlyph2D.cxx
   vvSlicerManager.cxx
   vvSlicerManagerCommand.cxx
+  vvToolHistogramCommand.cxx
   vvUtils.cxx
 #  vvMaximumIntensityProjection.cxx 
  vvMesh.cxx
diff --git a/vv/icons/histogram.png b/vv/icons/histogram.png
new file mode 100644 (file)
index 0000000..2690413
Binary files /dev/null and b/vv/icons/histogram.png differ
index b0b8d39d879bbff1b9faed78be1c21baaf00dfdb..8eb2d87606b2a1142619fd3be4a39180559d3141 100644 (file)
@@ -401,13 +401,6 @@ p, li { white-space: pre-wrap; }
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
-         <property name="toolTip">
-          <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;in mebibytes (2&lt;span style=&quot; vertical-align:super;&quot;&gt;20&lt;/span&gt; bytes, not 10&lt;span style=&quot; vertical-align:super;&quot;&gt;6&lt;/span&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
          <property name="text">
           <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
index ec4051a3b58bfc22032c84286e8acacc6de3f2a5..fa205e0798786e904a8c2042e744e32090353ed6 100644 (file)
        <item row="0" column="8">
         <widget class="QDoubleSpinBox" name="windowSpinBox">
          <property name="decimals">
-          <number>3</number>
+          <number>6</number>
          </property>
          <property name="minimum">
           <double>-66000.000000000000000</double>
        <item row="0" column="11">
         <widget class="QDoubleSpinBox" name="levelSpinBox">
          <property name="decimals">
-          <number>3</number>
+          <number>6</number>
          </property>
          <property name="minimum">
           <double>-66000.000000000000000</double>
diff --git a/vv/qt_ui/vvToolHistogram.ui b/vv/qt_ui/vvToolHistogram.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 a5e31ccdfbfc6853ade30da993a50c4498b868ee..6bb8c9391ade00d2a3818c70367e6954746b409d 100644 (file)
@@ -13,6 +13,7 @@
     <file>icons/1b.png</file>
     <file>icons/binarize.png</file>
     <file>icons/profile.png</file>
+    <file>icons/histogram.png</file>
     <file>icons/resample.png</file>
     <file>icons/crop.png</file>
     <file>icons/splashscreen2.png</file>
index 722e5343c91f54803abe4f1ceb874c9a6bfa2133..b123f404f8aff71f547597cac7359307ede5890c 100644 (file)
 
 // qt
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QDialog>
 
 // clitk 
index eadf342cb14812b8edb9554e7e360bb06d299918..178acb2a07f48fd55eb3d70ff40e417494cbe93e 100644 (file)
 
 // qt
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QDialog>
 #include "ui_vvLabelImageLoaderWidget.h"
 
index a3d2000cbd9da993edcd9adccbd3b1130eaf9358..aa10ded56d9944dcb11d86c8f39085e3bf95f96e 100644 (file)
@@ -416,7 +416,7 @@ void vvMainWindow::UpdateMemoryUsage()
 { 
   //  clitk::PrintMemory(true);
   if (clitk::GetMemoryUsageInMb() == 0) infoPanel->setMemoryInMb("NA");
-  else infoPanel->setMemoryInMb(QString::number(clitk::GetMemoryUsageInMb())+" MiB");
+  else infoPanel->setMemoryInMb(QString::number(clitk::GetMemoryUsageInMb())+" MB");
 }
 //------------------------------------------------------------------------------
 
@@ -1173,7 +1173,7 @@ void vvMainWindow::ImageInfoChanged()
       sizeMM[i] = inputSize[i]*inputSpacing[i];
       NPixel *= inputSize[i];
     }
-    inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000);
+    inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize());
 
     QString dim = QString::number(dimension) + " (";
     dim += pixelType + ")";
@@ -1374,15 +1374,15 @@ QString vvMainWindow::GetSizeInBytes(unsigned long size)
   if (size > 1000000000) {
     size /= 1000000000;
     result += QString::number(size);
-    result += "Gb";//)";
+    result += "GB";//)";
   } else if (size > 1000000) {
     size /= 1000000;
     result += QString::number(size);
-    result += "Mb";//)";
+    result += "MB";//)";
   } else if (size > 1000) {
     size /= 1000;
     result += QString::number(size);
-    result += "kb";//)";
+    result += "kB";//)";
   }
   return result;
 }
index 8ac997924a0bd4a2fbd720f68b71001a51ab885e..72821b70cb8c9bf9c5ac42c48e264ec4c87484a1 100644 (file)
@@ -22,6 +22,8 @@
 // qt include
 #include <QProgressDialog>
 
+#include "clitkCommon.h"
+
 class vvQProgressDialogITKCommand : public itk::Command {
 
 public:
@@ -33,8 +35,8 @@ public:
 
     void Initialize(QString title, float sec, int max);
 
-    void Execute(itk::Object *caller, const itk::EventObject & event);
-    void Execute(const itk::Object *caller, const itk::EventObject & event);
+    void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE;
+    void Execute(const itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE;
 
 protected:
     vvQProgressDialogITKCommand();
index a34c464cfa2bd17a7e0063ba5c54ee7ab50da967..b10a2cbacb31e9212a7d95ea12aaa4e450fd83b9 100644 (file)
@@ -29,8 +29,13 @@ protected:
   std::string ReadVector(int index);
   std::string ReadLink();
 
+#if __cplusplus > 199711L
+  std::shared_ptr<QXmlStreamReader> m_XmlReader;
+  std::shared_ptr<QFile> m_File;
+#else
   std::auto_ptr<QXmlStreamReader> m_XmlReader;
   std::auto_ptr<QFile> m_File;
+#endif
   vvMainWindow* m_Window;
   int m_TreeItemCount;
   int m_NumImages;
index 4f96c063e15a61e413fa1bbb531422111603ff6f..8085e25b697fa44d9c88ddf84c3987336d23faf4 100644 (file)
@@ -30,8 +30,13 @@ protected:
   void SaveVector(const QTreeWidgetItem* item);
   void SaveLink(const vvSlicerManager* slicerManager);
 
+#if __cplusplus > 199711L
+  std::shared_ptr<QXmlStreamWriter> m_XmlWriter;
+  std::shared_ptr<QFile> m_File;
+#else
   std::auto_ptr<QXmlStreamWriter> m_XmlWriter;
   std::auto_ptr<QFile> m_File;
+#endif
   vvMainWindow* m_Window;
 };
 
index a3af4a39575b6be2efc1034649a8108b43099ae0..f457df5ee6e7e4864bd4a9e04843330af9ad1a42 100644 (file)
 #include "vtkPolyData.h"
 #include <vtkPolyDataMapper.h>
 
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QTreeWidget>
 
 //====================================================================
index 46139cd75fa1b6d7bb3a3b66a0d873d25ee6cdbf..ce6d335abdd69cac344c49c0305f596be7fb9ebf 100644 (file)
@@ -150,10 +150,10 @@ vvSlicer::vvSlicer()
 
   legend = vtkSmartPointer<vtkScalarBarActor>::New();
   //legend->SetTitle("test!");
-  legend->SetPosition(0.82,0.18);
-  legend->SetWidth(0.1);
+  legend->SetPosition(0.82,0.08);
+  //legend->SetWidth(0.1);
   legend->SetVisibility(0);
-  legend->SetLabelFormat("%.1f");
+  legend->SetLabelFormat("%.1e");
   this->GetRenderer()->AddActor(legend);
   showFusionLegend = false;
 
@@ -170,6 +170,7 @@ vvSlicer::vvSlicer()
   mConcatenatedTransform = vtkSmartPointer<vtkTransform>::New();
   mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
   mConcatenatedOverlayTransform = vtkSmartPointer<vtkTransform>::New();
+  mConcatenatedVFTransform = vtkSmartPointer<vtkTransform>::New();
   mFirstSetSliceOrientation = true;
 }
 //------------------------------------------------------------------------------
@@ -393,7 +394,7 @@ void vvSlicer::SetImage(vvImage::Pointer image)
     mImageReslice->GetOutput()->SetUpdateExtent(extent);
     mImageReslice->GetOutput()->Update();
 #else
-    //mImageReslice->SetUpdateExtent(extent);
+    mImageReslice->SetUpdateExtent(extent);
     mImageReslice->Update();
 #endif
 
@@ -583,15 +584,31 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
     mVFVisibility = true;
 
     if (!mAAFilter) {
+      mVFReslice = vtkSmartPointer<vtkImageReslice>::New();
+      mVFReslice->SetInterpolationModeToLinear();
+      mVFReslice->AutoCropOutputOn();
+      mVFReslice->SetBackgroundColor(-1000,-1000,-1000,1);
       mAAFilter= vtkSmartPointer<vtkAssignAttribute>::New();
       mVOIFilter = vtkSmartPointer<vtkExtractVOI>::New();
       mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
     }
+
+    mConcatenatedVFTransform->Identity();
+    mConcatenatedVFTransform->Concatenate(mVF->GetTransform()[0]);
+    mConcatenatedVFTransform->Concatenate(mSlicingTransform);
+    mVFReslice->SetResliceTransform(mConcatenatedVFTransform);
 #if VTK_MAJOR_VERSION <= 5
-    mVOIFilter->SetInput(vf->GetFirstVTKImageData());
+    mVFReslice->SetInput(0, mVF->GetFirstVTKImageData());
+#else
+    mVFReslice->SetInputData(0, mVF->GetFirstVTKImageData());
+#endif
+    mVFReslice->Update();
+
+#if VTK_MAJOR_VERSION <= 5
+    mVOIFilter->SetInput(mVFReslice->GetOutput());
     mAAFilter->SetInput(mVOIFilter->GetOutput());
 #else
-    mVOIFilter->SetInputData(vf->GetFirstVTKImageData());
+    mVOIFilter->SetInputConnection(mVFReslice->GetOutputPort());
     mAAFilter->SetInputConnection(mVOIFilter->GetOutputPort());
 #endif
     ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
@@ -846,10 +863,14 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
   if (mVF && mVFActor->GetVisibility()) {
     if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
 #if VTK_MAJOR_VERSION <= 5
-      mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]);
+      mVFReslice->SetInput(mVF->GetVTKImages()[mCurrentTSlice]);
 #else
-      mVOIFilter->SetInputData(mVF->GetVTKImages()[mCurrentTSlice]);
+      mVFReslice->SetInputData(mVF->GetVTKImages()[mCurrentTSlice]);
 #endif
+      // Update overlay transform
+      mConcatenatedVFTransform->Identity();
+      mConcatenatedVFTransform->Concatenate(mVF->GetTransform()[mCurrentTSlice]);
+      mConcatenatedVFTransform->Concatenate(mSlicingTransform);
   }
   //update the overlay
   if (mOverlay && mOverlayActor->GetVisibility()) {
@@ -976,6 +997,9 @@ void vvSlicer::SetSliceOrientation(int orientation)
   if(mOverlay)
     AdjustResliceToSliceOrientation(mOverlayReslice);
 
+  if(mVF)
+    AdjustResliceToSliceOrientation(mVFReslice);
+
   // Update the viewer
   
   // Go to current cursor position
@@ -1193,14 +1217,15 @@ void vvSlicer::UpdateDisplayExtent()
     offset = -1;
   
   if (mVF && mVFVisibility) {
+    AdjustResliceToSliceOrientation(mVFReslice);
     int vfExtent[6];
 #if VTK_MAJOR_VERSION <= 5
     mVF->GetVTKImages()[0]->UpdateInformation();
-    this->ConvertImageToImageDisplayExtent(input, w_ext, mVF->GetVTKImages()[0], vfExtent);
+    this->ConvertImageToImageDisplayExtent(input, w_ext, mVFReslice->GetOutput(), vfExtent);
     bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
 #else
     mVOIFilter->Update();
-    this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mVF->GetVTKImages()[0], vfExtent);
+    this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mVFReslice->GetOutput(), vfExtent);
     bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
 #endif
     mVFActor->SetVisibility(!out);
index 23c19599958dcf66a5f67cfc8d8286c8ee38ba2f..3beab6e6181d0ee866d371f19389ed1befb5356c 100644 (file)
@@ -270,6 +270,8 @@ protected:
   vtkSmartPointer<vtkPolyDataMapper> mVFMapper;
   vtkSmartPointer<vtkLookupTable> mVFColorLUT;
   vtkSmartPointer<vtkActor> mVFActor;
+  vtkSmartPointer<vtkImageReslice> mVFReslice;
+  vtkSmartPointer<vtkTransform> mConcatenatedVFTransform;
   vtkSmartPointer<vtkGlyph3D> mLandGlyph;
   vtkSmartPointer<vtkCursor3D> mCross;
   vtkSmartPointer<vvClipPolyData> mLandClipper;
index 88a75a6924081fd4eca777d21dbed1c311dffac6..f53c9bb5ba0fdb0a93e02782e4c21a2960c38004 100644 (file)
@@ -23,7 +23,11 @@ class vtkPolyDataMapper;
 class vtkActor;
 class vtkOBJReader;
 
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QTreeWidget>
 
 //====================================================================
index 544bc5e4e133bb26a8251036abe5afacf41f8301..c71a2167ecdb0e73a2e12e3b3d4511edaf465bbf 100644 (file)
 #include "vvToolBaseBase.h"
 
 //------------------------------------------------------------------------------
-void vvToolBaseBase::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter) 
+#if __cplusplus > 199711L
+void vvToolBaseBase::SaveState(std::shared_ptr<QXmlStreamWriter> & m_XmlWriter)
+#else
+void vvToolBaseBase::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
+#endif
 { 
   std::cerr << "SaveState not implemented for this tool." << std::endl; 
 }
index fa93d14d7e8085588c11d30aa69d0c139621a2b4..9c76bb125bfbd4aba518bda40e903ce3e1b2ee77 100644 (file)
@@ -32,8 +32,11 @@ public:
     std::vector<vvToolBaseBase*> & v = mCreator->GetListOfTool();
     v.erase(std::find(v.begin(), v.end(), this));
   };
-  
+#if __cplusplus > 199711L
+  virtual void SaveState(std::shared_ptr<QXmlStreamWriter> & m_XmlWriter);
+#else
   virtual void SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter);
+#endif
   virtual void InitializeNewTool(bool ReadStateFlag);   
   void SetCreator(vvToolCreatorBase * m) { mCreator = m; }
   void SetXmlReader(QXmlStreamReader * r, int index) { m_XmlReader = r; mImageIndex = index;}  
index 89e001e5469f3cd0da592ebdcec598ad9910018b..4cdaa8515b2493ac6af85416e5bf4ca330d30c81 100644 (file)
 #define VVTOOLBINARIZE_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index b2c942fa5a65db646fb280f5636aea0568183f60..5ade4a4a0d27042d69519e8ac658bdb09663d0ed 100644 (file)
@@ -35,7 +35,7 @@ class vvToolCreatorBase: public QObject {
   public:
 
   vvToolCreatorBase(QString name);
-  virtual ~vvToolCreatorBase() {;}  
+  virtual ~vvToolCreatorBase() {}
   virtual void InsertToolInMenu(vvMainWindowBase * m);
   virtual void InsertToolInContextMenu();
   template<class ToolType> void CreateTool();
@@ -55,7 +55,11 @@ class vvToolCreatorBase: public QObject {
   bool mUseContextMenu;
   QMenu * mToolMenu;
   std::vector<QAction*> mListOfActions;
+#if __cplusplus > 199711L
+  std::shared_ptr<QXmlStreamReader> m_XmlReader;
+#else
   std::auto_ptr<QXmlStreamReader> m_XmlReader;
+#endif
   bool mReadStateFlag;
   int mImageIndex;
 
index 736a7d696fc04549e4b24d0b0f988a457620cbbb..0fb3e5483287485931862aefe3c188db5179f28d 100644 (file)
@@ -215,7 +215,7 @@ void vvToolCropImage::InputIsSelected(vvSlicerManager * slicer)
   }
 
 //   Set initial sliders values
-  int w_ext[6], imsize[3];
+  int w_ext[6], imsize[4];
   mCurrentSlicerManager->GetSlicer(0)->GetRegisterExtent(w_ext);
   for(int dim=0; dim<slicer->GetDimension() && dim<3; ++dim){
     imsize[dim] = w_ext[2*dim+1] - w_ext[2*dim] +1;
index 014fe3d03789e21a027c240b189a4b764a918c96..c5d8ce159822589291792ca6327ff36083bb2d45 100644 (file)
 
 //qt
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QDialog>
 #include <QSlider>
 // vv
index 91f7dfec6948c469586228dcca20ce189f768cac..e3526d677e8f09a742c72854405d688518952f91 100644 (file)
 ===========================================================================**/
 #ifndef VVTOOLFOO_H
 #define VVTOOLFOO_H
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QDialog>
 
 #include "vvToolBase.h"
index 0d07efd6f7e0773234a1cb77269b9e4bc16c721a..3458f9250170a913b8085df573025b5d7ddfdd36 100644 (file)
 ===========================================================================**/
 #ifndef VVTOOLFOO_H
 #define VVTOOLFOO_H
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
diff --git a/vv/vvToolHistogram.cxx b/vv/vvToolHistogram.cxx
new file mode 100644 (file)
index 0000000..24b0864
--- /dev/null
@@ -0,0 +1,472 @@
+/*=========================================================================
+  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
+  ===========================================================================**/
+
+#include <QFileDialog>
+#include <QShortcut>
+
+#include <algorithm>
+
+// vv
+#include "vvToolHistogram.h"
+#include "vvProgressDialog.h"
+#include "vvSlicerManager.h"
+#include "vvSlicer.h"
+#include "vvToolInputSelectorWidget.h"
+#include "vvToolHistogramCommand.h"
+
+// vtk
+#include <vtkAxis.h>
+#include <vtkImageActor.h>
+#include <vtkCamera.h>
+#include <vtkImageClip.h>
+#include <vtkRenderWindow.h>
+#include <vtkChartXY.h>
+#include <vtkPlot.h>
+#include <vtkRendererCollection.h>
+#include <vtkRenderer.h>
+
+#include <vtkLine.h>
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
+#include <vtkBox.h>
+#include <vtkInformation.h>
+
+#ifdef Q_OS_OSX
+# include "vvOSXHelper.h"
+#endif
+
+//------------------------------------------------------------------------------
+// Create the tool and automagically (I like this word) insert it in
+// the main window menu.
+ADD_TOOL(vvToolHistogram);
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::Initialize()
+{ 
+  SetToolName("Histogram");
+  SetToolMenuName("Intensity Histogram");
+  SetToolIconFilename(":/common/icons/histogram.png");
+  SetToolTip("Display the histogram of the image.");
+  SetToolExperimental(false);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolHistogram::vvToolHistogram(vvMainWindowBase * parent, Qt::WindowFlags f)
+  :vvToolWidgetBase(parent,f),
+   vvToolBase<vvToolHistogram>(parent),
+   Ui::vvToolHistogram()
+{ 
+  // GUI Initialization
+  Ui_vvToolHistogram::setupUi(mToolWidget);
+
+  mModificationsDone = false;
+
+  // Connect signals & slots
+  connect(mSaveHistogramButton, SIGNAL(clicked()), this, SLOT(SaveAs()));
+
+  // Initialize some widget
+  HistogramWidget->hide();
+
+  mView = vtkSmartPointer<vtkContextView>::New();
+  vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+  chart->SetAutoSize(false);
+  chart->SetRenderEmpty(true);
+  mView->GetScene()->AddItem(chart);
+  mView->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
+  this->HistogramWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+  this->HistogramWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+  HistogramWidget->show();
+
+#ifdef Q_OS_OSX
+  disableGLHiDPI(HistogramWidget->winId());
+#endif
+
+  // Main filter
+  mFilter = clitk::HistogramImageGenericFilter::New();
+
+  // Set how many inputs are needed for this tool
+  AddInputSelector("Select one image", mFilter);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolHistogram::~vvToolHistogram()
+{ 
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::computeHistogram()
+{
+    if (!mCurrentSlicerManager) close();
+    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+    GetArgsInfoFromGUI();
+    HistogramWidget->hide();
+
+    // Main filter
+    mFilter->SetInputVVImage(mCurrentImage);
+    mFilter->SetArgsInfo(mArgsInfo);
+    mFilter->Update();
+
+    //Creation of the XY chart
+    vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
+    vtkSmartPointer<vtkFloatArray> arrY = vtkSmartPointer<vtkFloatArray>::New();
+    arrX = mFilter->GetArrayX();
+    arrY = mFilter->GetArrayY();
+    arrX->SetName("Intensity");
+    arrY->SetName("#Voxels");
+    mTable->AddColumn(arrX);
+    mTable->AddColumn(arrY);
+
+    //Upper and Lower lines for window/level
+    vtkSmartPointer<vtkFloatArray> arrXUpperWindowLevel = vtkSmartPointer<vtkFloatArray>::New();
+    vtkSmartPointer<vtkFloatArray> arrXLowerWindowLevel = vtkSmartPointer<vtkFloatArray>::New();
+    vtkSmartPointer<vtkFloatArray> arrYWindowLevel = vtkSmartPointer<vtkFloatArray>::New();
+    arrXUpperWindowLevel->InsertNextTuple1(mMaxWindowLevel);
+    arrXUpperWindowLevel->InsertNextTuple1(mMaxWindowLevel);
+    arrXLowerWindowLevel->InsertNextTuple1(mMinWindowLevel);
+    arrXLowerWindowLevel->InsertNextTuple1(mMinWindowLevel);
+    arrYWindowLevel->InsertNextTuple1(0.0);
+    arrYWindowLevel->InsertNextTuple1(arrY->GetMaxNorm());
+    arrXUpperWindowLevel->SetName("IntensityUp");
+    arrXLowerWindowLevel->SetName("IntensityLow");
+    arrYWindowLevel->SetName("#Voxels");
+    mTableWindowLevel->AddColumn(arrXUpperWindowLevel);
+    mTableWindowLevel->AddColumn(arrXLowerWindowLevel);
+    mTableWindowLevel->AddColumn(arrYWindowLevel);
+
+    displayHistogram();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::displayHistogram()
+{
+    if (!mCurrentSlicerManager) close();
+    HistogramWidget->hide();
+
+
+    vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
+    chart->SetAutoSize(true);
+    mView->GetScene()->ClearItems();
+    mView->GetScene()->AddItem(chart);
+    vtkPlot *line = chart->AddPlot(vtkChart::LINE);
+#if VTK_MAJOR_VERSION <= 5
+    line->SetInput(mTable, 0, 1);
+#else
+    line->SetInputData(mTable, 0, 1);
+#endif
+    line->SetColor(0, 255, 0, 255);
+    line->SetWidth(1.0);
+
+
+    vtkPlot *upperWindowLine = chart->AddPlot(vtkChart::LINE);
+    vtkPlot *lowerWindowLine = chart->AddPlot(vtkChart::LINE);
+#if VTK_MAJOR_VERSION <= 5
+    upperWindowLine->SetInput(mTableWindowLevel, 0, 2);
+    lowerWindowLine->SetInput(mTableWindowLevel, 1, 2);
+#else
+    upperWindowLine->SetInputData(mTableWindowLevel, 0, 2);
+    lowerWindowLine->SetInputData(mTableWindowLevel, 1, 2);
+#endif
+    upperWindowLine->SetColor(255, 0, 0, 255);
+    lowerWindowLine->SetColor(255, 0, 0, 255);
+    upperWindowLine->SetWidth(1.0);
+    lowerWindowLine->SetWidth(1.0);
+
+    chart->GetAxis(vtkAxis::LEFT)->SetTitle("#Voxels");
+    chart->GetAxis(vtkAxis::BOTTOM)->SetTitle("Intensity");
+
+    this->HistogramWidget->GetRenderWindow()->GetRenderers()->RemoveAllItems();
+    this->HistogramWidget->GetRenderWindow()->AddRenderer(mView->GetRenderer());
+    HistogramWidget->show();
+
+    QApplication::restoreOverrideCursor();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::changeWindowLevel()
+{
+  vtkFloatArray* upperArray = vtkFloatArray::New();
+  upperArray = static_cast<vtkFloatArray*>(mTableWindowLevel->GetColumn(0));
+  upperArray->SetTuple1(0, mMaxWindowLevel);
+  upperArray->SetTuple1(1, mMaxWindowLevel);
+  vtkFloatArray* lowerArray = vtkFloatArray::New();
+  lowerArray = static_cast<vtkFloatArray*>(mTableWindowLevel->GetColumn(1));
+  lowerArray->SetTuple1(0, mMinWindowLevel);
+  lowerArray->SetTuple1(1, mMinWindowLevel);
+  displayHistogram();
+  mCurrentSlicerManager->UpdateWindowLevel();
+  mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::windowLevelChanged()
+{
+  computeMinMax();
+  changeWindowLevel();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::RemoveVTKObjects()
+{ 
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+bool vvToolHistogram::close()
+{ 
+  if (!mModificationsDone)
+  {
+    mCurrentSlicerManager->SetColorLevel(originalLevel);
+    mCurrentSlicerManager->SetColorWindow(originalWindow);
+    mCurrentSlicerManager->UpdateWindowLevel();
+    mCurrentSlicerManager->Render();
+  }
+  return vvToolWidgetBase::close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::closeEvent(QCloseEvent *event)
+{ 
+  RemoveVTKObjects();
+  event->accept();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::reject()
+{ 
+  // DD("vvToolHistogram::reject");
+  RemoveVTKObjects();
+  return vvToolWidgetBase::reject();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::InputIsSelected(vvSlicerManager * m)
+{ 
+  mCurrentSlicerManager = m;
+
+  mSaveHistogramButton->setEnabled(true);
+  mTextFileName = "Histogram.txt";
+
+  mTableWindowLevel = vtkSmartPointer<vtkTable>::New();
+  mTable = vtkSmartPointer<vtkTable>::New();
+
+  originalWindow = mCurrentSlicerManager->GetColorWindow();
+  originalLevel = mCurrentSlicerManager->GetColorLevel();
+
+  //Compute Min & Max for Window/Level
+  computeMinMax();
+
+  computeHistogram();
+
+  // Connect signals & slots
+  vvToolHistogramCommand *smc = vvToolHistogramCommand::New();
+  smc->mHist = this;
+  HistogramWidget->GetRenderWindow()->GetInteractor()->GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonPressEvent, smc);
+  HistogramWidget->GetRenderWindow()->GetInteractor()->GetInteractorStyle()->AddObserver(vtkCommand::MouseMoveEvent, smc);
+  HistogramWidget->GetRenderWindow()->GetInteractor()->GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelForwardEvent, smc);
+  HistogramWidget->GetRenderWindow()->GetInteractor()->GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelBackwardEvent, smc);
+  smc->Delete();
+
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+QVTKWidget* vvToolHistogram::GetHistogramWidget()
+{
+  return(HistogramWidget);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::computeMinMax()
+{
+  mMinWindowLevel = mCurrentSlicerManager->GetColorLevel() - mCurrentSlicerManager->GetColorWindow()/2.0;
+  mMaxWindowLevel = mCurrentSlicerManager->GetColorLevel() + mCurrentSlicerManager->GetColorWindow()/2.0;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::computeWindowLevel()
+{
+  double window = mMaxWindowLevel - mMinWindowLevel;
+  double level = (mMaxWindowLevel + mMinWindowLevel)/2.0;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::expandWindow()
+{
+  mCurrentSlicerManager->SetColorWindow(mCurrentSlicerManager->GetColorWindow()+10.0);
+  computeMinMax();
+  changeWindowLevel();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::reduceWindow()
+{
+  mCurrentSlicerManager->SetColorWindow(mCurrentSlicerManager->GetColorWindow()-10.0);
+  computeMinMax();
+  changeWindowLevel();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::translateWindow(double x)
+{
+  mCurrentSlicerManager->SetColorLevel(mCurrentSlicerManager->GetColorLevel()+10.0*x);
+  computeMinMax();
+  changeWindowLevel();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::GetArgsInfoFromGUI()
+{ 
+
+  /* //KEEP THIS FOR READING GGO FROM FILE
+     int argc=1;
+     std::string a = "toto";
+     char * const* argv = new char*;
+     //a.c_str();
+     struct cmdline_parser_params p;
+     p.check_required = 0;
+     int good = cmdline_parser_ext(argc, argv, &args_info, &p);
+     DD(good);
+  */
+  cmdline_parser_clitkHistogramImage_init(&mArgsInfo); // Initialisation to default
+
+  mArgsInfo.verbose_flag = false;
+
+  // Required (even if not used)
+  mArgsInfo.input_given = 0;
+  mArgsInfo.output_given = 0;
+
+  mArgsInfo.input_arg = new char;
+  mArgsInfo.output_arg = new char;
+
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::apply()
+{
+  mModificationsDone = true;
+  close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogram::SaveAs()
+{ 
+  QStringList OutputListeFormat;
+  OutputListeFormat.clear();
+  OutputListeFormat.push_back(".txt");
+  
+  QString Extensions = "AllFiles(*.*)";
+  for (int i = 0; i < OutputListeFormat.count(); i++) {
+    Extensions += ";;Text File ( *";
+    Extensions += OutputListeFormat[i];
+    Extensions += ")";
+  }
+  QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), mTextFileName.c_str(), Extensions);
+  if (!fileName.isEmpty()) {
+    std::string fileformat = itksys::SystemTools::GetFilenameLastExtension(fileName.toStdString());
+    QString fileQFormat = fileformat.c_str();
+    if (OutputListeFormat.contains(fileformat.c_str()) || fileQFormat.isEmpty()) {
+        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+        std::string action = "Saving";
+        vvProgressDialog progress("Saving "+fileName.toStdString());
+        qApp->processEvents();
+        
+        if (!mCurrentSlicerManager) {
+            close();
+            return;
+        }
+
+        // Output
+        mTextFileName = fileName.toStdString();
+        if (fileQFormat.isEmpty())
+            mTextFileName += ".txt";
+        ofstream fileOpen(mTextFileName.c_str(), std::ofstream::trunc);
+  
+        if(!fileOpen) {
+            cerr << "Error during saving" << endl;
+            QApplication::restoreOverrideCursor();
+            close();
+            return;
+        }
+        
+        vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
+        vtkSmartPointer<vtkFloatArray> arrY = vtkSmartPointer<vtkFloatArray>::New();
+        vtkSmartPointer<vtkFloatArray> coords = vtkSmartPointer<vtkFloatArray>::New();
+        arrX = mFilter->GetArrayX();
+        arrY = mFilter->GetArrayY();
+        int i(0);
+        fileOpen << "Value represents the number of voxels around the corresponding intensity (by default the windows size around intensity is log(range))" << endl;
+        fileOpen << "Intensity" << "\t" << "Value" << endl;
+   
+        while (i<arrX->GetNumberOfTuples()) {
+            fileOpen << arrX->GetTuple(i)[0] << "\t" << arrY->GetTuple(i)[0] << endl;
+            ++i;
+        }
+
+        fileOpen.close();
+        QApplication::restoreOverrideCursor();
+    } else {
+      QString error = fileformat.c_str();
+      error += " format unknown !!!\n";
+      QMessageBox::information(this,tr("Saving Problem"),error);
+      SaveAs();
+    }
+  }
+}
+//------------------------------------------------------------------------------
diff --git a/vv/vvToolHistogram.h b/vv/vvToolHistogram.h
new file mode 100644 (file)
index 0000000..437e4e6
--- /dev/null
@@ -0,0 +1,103 @@
+/*=========================================================================
+  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 VVTOOLHISTOGRAM_H
+#define VVTOOLHISTOGRAM_H
+
+#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
+#include <QtDesigner/QDesignerExportWidget>
+#endif
+
+#include "vvToolBase.h"
+#include "vvToolWidgetBase.h"
+#include "ui_vvToolHistogram.h"
+
+#include "clitkHistogramImage_ggo.h"
+#include "clitkHistogramImageGenericFilter.h"
+#include <vtkTable.h>
+#include <vtkContextView.h>
+#include <vtkContextScene.h>
+#include <vtkInteractorObserver.h>
+#include <vtkEventQtSlotConnect.h>
+
+//------------------------------------------------------------------------------
+class vvToolHistogram:
+  public vvToolWidgetBase,
+  public vvToolBase<vvToolHistogram>, 
+  private Ui::vvToolHistogram
+{
+  Q_OBJECT
+    public:
+  vvToolHistogram(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
+  ~vvToolHistogram();
+
+  //-----------------------------------------------------
+  static void Initialize();
+  void GetArgsInfoFromGUI();
+  virtual void InputIsSelected(vvSlicerManager * m);
+
+  void computeHistogram();
+  void changeWindowLevel();
+  void computeWindowLevel();
+  void computeMinMax();
+  void SetPoints();
+
+  void displayHistogram();
+
+  QVTKWidget* GetHistogramWidget();
+
+  //-----------------------------------------------------
+  public slots:
+  virtual void apply();
+  virtual bool close();
+  virtual void reject();
+
+  void windowLevelChanged();
+  void reduceWindow();
+  void expandWindow();
+  void translateWindow(double x);
+
+  void SaveAs();
+
+ protected:
+  void RemoveVTKObjects();
+  virtual void closeEvent(QCloseEvent *event);
+  Ui::vvToolHistogram ui;
+  args_info_clitkHistogramImage mArgsInfo;
+
+  double mMinWindowLevel;
+  double mMaxWindowLevel;
+  double originalWindow;
+  double originalLevel;
+  bool mModificationsDone;
+
+  vtkSmartPointer<vtkContextView> mView;
+
+  vtkSmartPointer<vtkTable> mTableWindowLevel;
+  vtkSmartPointer<vtkTable> mTable;
+  //vtkSmartPointer<vtkContextView> mView;
+  clitk::HistogramImageGenericFilter::Pointer mFilter;
+  std::string mTextFileName;
+
+}; // end class vvToolHistogram
+//------------------------------------------------------------------------------
+
+#endif
+
diff --git a/vv/vvToolHistogramCommand.cxx b/vv/vvToolHistogramCommand.cxx
new file mode 100644 (file)
index 0000000..585f16c
--- /dev/null
@@ -0,0 +1,73 @@
+/*=========================================================================
+  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
+===========================================================================**/
+#include "vvToolHistogramCommand.h"
+#include "vvSlicerManager.h"
+
+#include <vtkTextProperty.h>
+#include <vtkRenderer.h>
+#include <vtkImageActor.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkPropPicker.h>
+#include <vtkCamera.h>
+#include <vtkImageMapToWindowLevelColors.h>
+#include <vtkLookupTable.h>
+#include <vtkMath.h>
+#include <vtkAbstractPropPicker.h>
+#include <vtkAssemblyPath.h>
+#include <vtkCornerAnnotation.h>
+#include <vtkRenderWindow.h>
+#include <vvImage.h>
+#include <vtkImageReslice.h>
+#include "vvSlicer.h"
+#include "vvInteractorStyleNavigator.h"
+#include "vtkTransform.h"
+
+#include <cmath>
+//------------------------------------------------------------------------------
+vvToolHistogramCommand::vvToolHistogramCommand()
+{
+  mFollowMouse = false;
+}
+//------------------------------------------------------------------------------
+
+
+
+
+//------------------------------------------------------------------------------
+void vvToolHistogramCommand::Execute(vtkObject *caller,
+                                     unsigned long event,
+                                     void *vtkNotUsed(callData))
+{
+  if (event == vtkCommand::MouseWheelForwardEvent) {
+    mHist->expandWindow();
+  }
+  if (event == vtkCommand::MouseWheelBackwardEvent) {
+    mHist->reduceWindow();
+  }
+  if (event == vtkCommand::LeftButtonPressEvent) {
+    mFollowMouse = !mFollowMouse;
+  }
+  if (event == vtkCommand::MouseMoveEvent) {
+    if (mFollowMouse) {
+      vtkSmartPointer<vtkRenderWindowInteractor> interactor = mHist->GetHistogramWidget()->GetRenderWindow()->GetInteractor();
+      if (interactor->GetEventPosition()[0] != interactor->GetLastEventPosition()[0])
+        mHist->translateWindow(interactor->GetEventPosition()[0] - interactor->GetLastEventPosition()[0]);
+    }
+  }
+}
+//------------------------------------------------------------------------------
diff --git a/vv/vvToolHistogramCommand.h b/vv/vvToolHistogramCommand.h
new file mode 100644 (file)
index 0000000..0a73dbe
--- /dev/null
@@ -0,0 +1,56 @@
+/*=========================================================================
+  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 __vvToolHistogramCommand_h
+#define __vvToolHistogramCommand_h
+#include "vtkCommand.h"
+#include "vvSlicerManager.h"
+#include "vvToolHistogram.h"
+#include "vtkRenderWindow.h"
+#include "vtkRenderer.h"
+#include "vtkImageData.h"
+#include "vtkImageActor.h"
+#include "vvInteractorStyleNavigator.h"
+#include "vtkRenderWindowInteractor.h"
+#include "vtkInteractorStyleImage.h"
+#include "vtkPropPicker.h"
+
+#include <iostream>
+#include <string>
+#include <sstream>
+
+class vvToolHistogramCommand : public vtkCommand
+{
+public:
+    static vvToolHistogramCommand *New() {
+        return new vvToolHistogramCommand;
+    }
+
+    void Execute(vtkObject *caller,
+                 unsigned long event,
+                 void *vtkNotUsed(callData));
+
+    vvToolHistogram* mHist;
+
+protected :
+    vvToolHistogramCommand();
+    ~vvToolHistogramCommand() {}
+
+    bool mFollowMouse;
+};
+
+#endif
index 9fe70ce15b2062791ee1f001a8301b375ad2afd9..964b9c81219d6075c23545411a1b9ac7d6f2b3f5 100644 (file)
 #define VVTOOLImageArithm_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index 07dbd483735d503f19565be897b260357574375c..76e0c34f1137a321504587c47a8b4d3bc7176eb0 100644 (file)
 
 // qt
 #include <QObject>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QDialog>
 
 // vv
index e3904a68702f1b7011475fc26531c26b01231703..e915525cb03814924ad482f8394d6d3d066babcb 100644 (file)
@@ -48,7 +48,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <vvImage.h>
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include "vvToolBase.h"
 #include "QWidget"
 #include "vvToolWidgetBase.h"
index 915271275f706279a0f2348d200096fd1abe164e..b075ac17b795993ea3d2a3ba24fb86fe20397fd1 100644 (file)
   #define VVTOOLMedianFilter_H
 
   #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+  #include <QtUiPlugin/QDesignerExportWidget>
+#else
   #include <QtDesigner/QDesignerExportWidget>
+#endif
   #include "vvToolBase.h"
   #include "QWidget"
   #include "vvToolWidgetBase.h"
index d808abdd52603a5e8d9c2203ecf767975fdf6c68..ff56b8ab8318d11506c398a7a17e704133f778c4 100644 (file)
 #ifndef VVTOOLPLASTIMATCH_H
 #define VVTOOLPLASTIMATCH_H
 
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index e0ebdf1c14f283e7795a54e4adfbecaec5cf0ce8..7ef23101a2ab9d5d0263caad118f0c09a6120e73 100644 (file)
@@ -511,50 +511,8 @@ void vvToolProfile::SaveAs()
             close();
             return;
         }
-        
-        vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
-        vtkSmartPointer<vtkFloatArray> arrY = vtkSmartPointer<vtkFloatArray>::New();
-        vtkSmartPointer<vtkFloatArray> coords = vtkSmartPointer<vtkFloatArray>::New();
-        arrX = mFilter->GetArrayX();
-        arrY = mFilter->GetArrayY();
-        coords = mFilter->GetCoord();
-        double *tuple;
-        tuple = new double[mCurrentSlicerManager->GetImage()->GetNumberOfDimensions()];
-        int i(0);
-        fileOpen << "The Bresenham algorithm is used to travel along the line. Values represent the center of each crossed voxel (in voxel and mm)" << endl;
-        fileOpen << "Id" << "\t" << "Value" << "\t" ;
-        fileOpen << "x(vox)" << "\t" << "y(vox)" << "\t";
-        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=3)
-            fileOpen << "z(vox)" << "\t";
-        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=4)
-            fileOpen << "t" << "\t";
-        fileOpen << "x(mm)" << "\t" << "y(mm)" << "\t";
-        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=3)
-            fileOpen << "z(mm)" << "\t";
-        if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() >=4)
-            fileOpen << "t" << "\t";
-        fileOpen << endl;
-   
-        while (i<arrX->GetNumberOfTuples()) {
-            fileOpen << i << "\t" << arrY->GetTuple(i)[0] << "\t" ;
-      
-            coords->GetTuple(i, tuple);
-            for (int j=0; j<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() ; ++j) {
-                fileOpen << tuple[j] << "\t" ;
-            }
-            int j(0);
-            while (j<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() && j<3) {
-                fileOpen << tuple[j]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetImage()->GetVTKImages()[mCurrentSlicerManager->GetTSlice()]->GetSpacing()[j]+mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetImage()->GetVTKImages()[mCurrentSlicerManager->GetTSlice()]->GetOrigin()[j] << "\t" ;
-                ++j;
-            }
-            if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
-                fileOpen << tuple[3] << "\t" ;
-            }
-            fileOpen << endl;
-            ++i;
-        }
-  
-        delete [] tuple;
+
+        mFilter->WriteOutput(mTextFileName.c_str());
 
         fileOpen.close();
         QApplication::restoreOverrideCursor();
index 2f64bb3a656e28f10b93cf0107f35abe430714fb..0410637f396b79a1f08faad0502c97b0918aef7e 100644 (file)
 #define VVTOOLPROFILE_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index 791db06f8922e537dc45409373bbf6884b49468d..4c2832e0ced363bbc1d1cfe995f47a86700f8872 100644 (file)
@@ -865,7 +865,11 @@ void vvToolROIManager::ReloadCurrentROI()
 
 
 //------------------------------------------------------------------------------
+#if __cplusplus > 199711L
+void  vvToolROIManager::SaveState(std::shared_ptr<QXmlStreamWriter> & m_XmlWriter)
+#else
 void  vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
+#endif
 { 
   // Get index of the image
   int n = mMainWindow->GetSlicerManagers().size();
index 9cb993ad6f57dac5ab5b6185c54e64189bf487b9..db630c641b059c4838a376d7bdfdf380a70d4fd5 100644 (file)
 #define VVTOOLROIMANAGER_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QSharedPointer>
 
 #include "vvToolBase.h"
@@ -47,7 +51,11 @@ class vvToolROIManager:
   void AddImage(vvImage * binaryImage, std::string name, std::string filename, double BG, bool m_modeBG=true);
   void UpdateAllContours();
   void UpdateAllROIStatus();
+#if __cplusplus > 199711L
+  virtual void SaveState(std::shared_ptr<QXmlStreamWriter> & m_XmlWriter);
+#else
   virtual void SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter);
+#endif
   virtual void InitializeNewTool(bool ReadStateFlag);
 
   public slots:
index ec56fda68cfbd40d410ae0b2f1b78c0e76c7a35f..2a4c427c5d3e4b78a5b07ac2fcc60d6ecdebfa7d 100644 (file)
 #include "vvToolBase.h"
 
 // qt
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QTreeWidget>
 
 //------------------------------------------------------------------------------
index e50ab7fda50ec3a927afc399a5796d98d038f550..5a11c7f8e367dad022cf08bc8b54cf06a92e92ed 100644 (file)
@@ -413,7 +413,7 @@ void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
     double rad = (checkBoxDegrees->checkState()==Qt::Checked)?180./itk::Math::pi:1.;
     double angleDiff = euler->GetParameters()[i]-rotSBs[i]->value()/rad+2*itk::Math::pi;
     angleDiff = angleDiff - 2*itk::Math::pi*itk::Math::Round<double,double>(angleDiff/(2*itk::Math::pi));
-    if(abs(angleDiff)>1.e-4) {
+    if(std::abs(angleDiff)>1.e-4) {
       rotSBs[i]->blockSignals(true);
       rotSBs[i]->setValue( euler->GetParameters()[i]*rad );
       rotSBs[i]->blockSignals(false);
index 25bf6d018ba19ae57c943ed0c6564c7034671021..7e49dc46efc67486f496eb0be6c0093da113ac77 100644 (file)
 #define VVTOOLSEGMENTATION_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
index dfc83b14b5806453486bed7712419d7e863a7af3..4b8028fa2f9b84a600ddb69ebf236c20cd4b166a 100644 (file)
 #define VVTOOLSIMPLEINPUTSELECTORWIDGET_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include <QDialog>
 #include "ui_vvToolSimpleInputSelectorWidget.h"
 
index 0f5ffec81a4c6d413fc0a5a85833c59153fbf6d4..5bc88c2d479100363d0b9864fca143a4d87046a7 100644 (file)
 #ifndef VVTOOLSTRUCTURESETMANAGER_H
 #define VVTOOLSTRUCTURESETMANAGER_H
 
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
 #include "clitkDicomRT_StructureSet.h"
index 8e5405a674e69111748a5a6fe1697b3a81f02249..7a3a5dfdc6e6ac692b58641e628250c72f4cb535 100644 (file)
 #define VVTOOLWIDGETBASE_H
 
 #include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
 #include <QtDesigner/QDesignerExportWidget>
+#endif
 #include "ui_vvToolWidgetBase.h"
 #include "clitkImageToImageGenericFilter.h"