- 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
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
- 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:
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)
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
# 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
# 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
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
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!!!"
-#! /usr/local/bin/bash -lx
+#! /bin/bash -lx
set -u
SCRIPTNAME="$(basename "${0}")"
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
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
# 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)
#=========================================================
# 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()
#=========================================================
exit(-3); \
}
+#ifndef ITK_OVERRIDE
+# define ITK_OVERRIDE
+#endif
//--------------------------------------------------------------------
// when everything goes wrong
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);
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";
}
#include <fstream>
#include <string.h>
+#include "clitkCommon.h"
+
namespace clitk
{
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;
#include <itkObjectFactoryBase.h>
#include <itkVersion.h>
+#include "clitkCommon.h"
+
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 "Esrf Hst ImageIO Factory, allows the loading of Esrf Hst images into insight";
}
#include <map>
+#include "clitkCommon.h"
+
namespace clitk
{
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
#include <stdint.h>
#endif
+#include "clitkCommon.h"
+
namespace clitk
{
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);
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";
}
/*=========================================================================
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
# 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) {
#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
}
-
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;
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";
}
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;
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";
}
#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 {
//====================================================================
/*-------- 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);
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";
}
#include <fstream>
#include <string.h>
+#include "clitkCommon.h"
+
namespace rtk {
/** \class EdfImageIO
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;
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";
}
// itk include
#include <itkImageIOBase.h>
+#include "clitkCommon.h"
+
namespace rtk
{
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;
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";
}
#include <stdint.h>
#endif
+#include "clitkCommon.h"
+
namespace rtk {
/** \class HndImageIO
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
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";
}
#include <fstream>
#include <string.h>
+#include "clitkCommon.h"
+
namespace rtk
{
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;
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";
}
#include <map>
+#include "clitkCommon.h"
+
namespace rtk
{
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
#include <fstream>
#include <string.h>
+#include "clitkCommon.h"
+
namespace rtk {
/** \class XRadImageIO
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:
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";
}
{
unsigned long size = 0;
for (unsigned int i = 0; i < mVtkImages.size(); i++) {
- size += mVtkImages[i]->GetActualMemorySize();
+ size += mVtkImages[i]->GetActualMemorySize()*1024;
}
return size;
}
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);
output->SetRegions(region);
output->SetOrigin(origin);
output->SetSpacing(spacing);
+ output->SetDirection(direction);
output->Allocate();
//Copy each channel
}
}
- if (VImageDimension == 4)
+/* if (VImageDimension == 4)
mType == VECTORPIXELIMAGEWITHTIME;
else
- mType == VECTORPIXELIMAGE;
+ mType == VECTORPIXELIMAGE;*/
try {
mImage = vvImageFromITK<VImageDimension,InputPixelType>(output, mType == VECTORPIXELIMAGEWITHTIME);
}
- virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
- void EnlargeOutputRequestedRegion (DataObject * output);
+ virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE;
+ void EnlargeOutputRequestedRegion (DataObject * output) ITK_OVERRIDE;
protected:
RelativePositionPropImageFilter()
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
} OrientationTypeEnumeration;
/** Input : initial image and object */
- void SetInput(const ImageType * image);
+ void SetInput(const ImageType * image) ITK_OVERRIDE;
void SetInputObject(const ImageType * image);
// Options
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();
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;
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);
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;
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;
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;
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();
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
FILTERBASE_INIT;
/** Input : initial image and object */
- void SetInput(const ImageType * image);
+ void SetInput(const ImageType * image) ITK_OVERRIDE;
// Options
itkGetConstMacro(Direction, int);
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;
//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;
protected:
InvertVFFilter();
~InvertVFFilter() {};
- void GenerateData( );
+ void GenerateData( ) ITK_OVERRIDE;
bool m_Verbose;
bool m_NumberOfThreadsIsGiven;
~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;
//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;
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 );
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
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();
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
public itk::PasteImageFilter< TInputImage, TSourceImage, TOutputImage >
{
public:
- virtual void VerifyInputInformation() { }
+ virtual void VerifyInputInformation() ITK_OVERRIDE { }
/** Standard class typedefs. */
typedef PasteImageFilter Self;
#include "itkImageToImageFilter.h"
#include "itkAffineTransform.h"
+#include "clitkCommon.h"
+
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);
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
#include "itkFlexibleBinaryFunctorImageFilter.h"
#include "itkNumericTraits.h"
+#include "clitkCommon.h"
+
namespace clitk
{
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;
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
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;
#include "itkBSplineWeightsCalculator.h"
#include <itkBSplineInterpolateImageFunction.h>
+#include "clitkCommon.h"
+
namespace itk {
template <
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 ... **/
#include "itkInPlaceImageFilter.h"
#include "itkImageRegionIteratorWithIndex.h"
+#include "clitkCommon.h"
+
namespace itk
{
}
}
- virtual void GenerateOutputInformation();
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateOutputInformation() ITK_OVERRIDE;
+ virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
/** ImageDimension constants */
itkStaticConstMacro(
* \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
}
// 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;
}
// 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;
}
}
}
- void Execute(const itk::Object * , const itk::EventObject & ) {
+ void Execute(const itk::Object * , const itk::EventObject & ) ITK_OVERRIDE {
return;
}
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;
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();
* (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,
#define __clitkLBFGSBOptimizer_h
#include "itkSingleValuedNonLinearVnlOptimizer.h"
+#include "clitkCommon.h"
+
namespace clitk
{
/** 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 );
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;
* (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:
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,
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;
* (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:
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,
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;
* (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,
MattesMutualInformationImageToImageMetricFor3DBLUTFFD();
virtual ~MattesMutualInformationImageToImageMetricFor3DBLUTFFD();
- void PrintSelf(std::ostream& os, Indent indent) const;
+ void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
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;
};
* (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:
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;
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)
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})
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();
imageToVectorImageFilter->Update();
- // Output
+ // Copy transform matrix
+ imageToVectorImageFilter->GetOutput()->SetDirection(direction);
+
+ //Output
writer->SetInput(imageToVectorImageFilter->GetOutput());
writer->SetFileName(fileName);
writer->Update();
--- /dev/null
+/*=========================================================================
+ 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
+//--------------------------------------------------------------------
--- /dev/null
+#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
+
+
+
--- /dev/null
+/*=========================================================================
+ 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
--- /dev/null
+/*=========================================================================
+ 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
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);
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
#include "vvImageWriter.h"
#include "itkFlipImageFilter.h"
#include "itkGDCMImageIO.h"
+#include <itkChangeInformationImageFilter.h>
#include "gdcmReader.h"
#include "gdcmAttribute.h"
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
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; }
bool mWarningOccur;
bool mDisplayWarning;
bool mVV;
+ bool mNoNiiMeta;
bool mCorrectNegativeSpacingFlag;
private:
#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);
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];
}
}
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);
}
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
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);
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)
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();
// 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);
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+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
#include "clitkImageToImageGenericFilter.h"
#include "clitkProfileImage_ggo.h"
-#include <vtkIntArray.h>
#include <vtkFloatArray.h>
//--------------------------------------------------------------------
vtkFloatArray* GetArrayY();
vtkFloatArray* GetCoord();
+ //Write the output in the txt file
+ void WriteOutput(std::string outputFilename);
+
protected:
ProfileImageGenericFilter();
template<unsigned int Dim> void InitializeImageType();
vtkSmartPointer<vtkFloatArray> mArrayX;
vtkSmartPointer<vtkFloatArray> mArrayY;
vtkSmartPointer<vtkFloatArray> mCoord;
+ vtkSmartPointer<vtkFloatArray> mCoordmm;
+ int mDimension;
}; // end class
-------------------------------------------------------------------*/
#include "clitkSplitImageGenericFilter.h"
+#include "itkChangeInformationImageFilter.h"
#include <itkIntensityWindowingImageFilter.h>
//--------------------------------------------------------------------
clitk::SplitImageGenericFilter::SplitImageGenericFilter():
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];
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());
+ }
}
}
}
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());
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());
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());
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
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
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
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
vvToolROIManager
vvToolSegmentation
vvToolProfile
+ vvToolHistogram
## these ones are for tests (not working)
# vvToolTest
# vvToolFoo
# >> 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)
vvGlyph2D.cxx
vvSlicerManager.cxx
vvSlicerManagerCommand.cxx
+ vvToolHistogramCommand.cxx
vvUtils.cxx
# vvMaximumIntensityProjection.cxx
vvMesh.cxx
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip">
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">in mebibytes (2<span style=" vertical-align:super;">20</span> bytes, not 10<span style=" vertical-align:super;">6</span>)</p></body></html></string>
- </property>
<property name="text">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
<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>
--- /dev/null
+<?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>
<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>
// qt
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QDialog>
// clitk
// qt
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QDialog>
#include "ui_vvLabelImageLoaderWidget.h"
{
// 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");
}
//------------------------------------------------------------------------------
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 + ")";
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;
}
// qt include
#include <QProgressDialog>
+#include "clitkCommon.h"
+
class vvQProgressDialogITKCommand : public itk::Command {
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();
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;
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;
};
#include "vtkPolyData.h"
#include <vtkPolyDataMapper.h>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QTreeWidget>
//====================================================================
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;
mConcatenatedTransform = vtkSmartPointer<vtkTransform>::New();
mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
mConcatenatedOverlayTransform = vtkSmartPointer<vtkTransform>::New();
+ mConcatenatedVFTransform = vtkSmartPointer<vtkTransform>::New();
mFirstSetSliceOrientation = true;
}
//------------------------------------------------------------------------------
mImageReslice->GetOutput()->SetUpdateExtent(extent);
mImageReslice->GetOutput()->Update();
#else
- //mImageReslice->SetUpdateExtent(extent);
+ mImageReslice->SetUpdateExtent(extent);
mImageReslice->Update();
#endif
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
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()) {
if(mOverlay)
AdjustResliceToSliceOrientation(mOverlayReslice);
+ if(mVF)
+ AdjustResliceToSliceOrientation(mVFReslice);
+
// Update the viewer
// Go to current cursor position
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);
vtkSmartPointer<vtkPolyDataMapper> mVFMapper;
vtkSmartPointer<vtkLookupTable> mVFColorLUT;
vtkSmartPointer<vtkActor> mVFActor;
+ vtkSmartPointer<vtkImageReslice> mVFReslice;
+ vtkSmartPointer<vtkTransform> mConcatenatedVFTransform;
vtkSmartPointer<vtkGlyph3D> mLandGlyph;
vtkSmartPointer<vtkCursor3D> mCross;
vtkSmartPointer<vvClipPolyData> mLandClipper;
class vtkActor;
class vtkOBJReader;
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QTreeWidget>
//====================================================================
#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;
}
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;}
#define VVTOOLBINARIZE_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
public:
vvToolCreatorBase(QString name);
- virtual ~vvToolCreatorBase() {;}
+ virtual ~vvToolCreatorBase() {}
virtual void InsertToolInMenu(vvMainWindowBase * m);
virtual void InsertToolInContextMenu();
template<class ToolType> void CreateTool();
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;
}
// 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;
//qt
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QDialog>
#include <QSlider>
// vv
===========================================================================**/
#ifndef VVTOOLFOO_H
#define VVTOOLFOO_H
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QDialog>
#include "vvToolBase.h"
===========================================================================**/
#ifndef VVTOOLFOO_H
#define VVTOOLFOO_H
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
--- /dev/null
+/*=========================================================================
+ 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();
+ }
+ }
+}
+//------------------------------------------------------------------------------
--- /dev/null
+/*=========================================================================
+ 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
+
--- /dev/null
+/*=========================================================================
+ 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]);
+ }
+ }
+}
+//------------------------------------------------------------------------------
--- /dev/null
+/*=========================================================================
+ 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
#define VVTOOLImageArithm_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
// qt
#include <QObject>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QDialog>
// vv
#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"
#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"
#ifndef VVTOOLPLASTIMATCH_H
#define VVTOOLPLASTIMATCH_H
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
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();
#define VVTOOLPROFILE_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
//------------------------------------------------------------------------------
+#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();
#define VVTOOLROIMANAGER_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QSharedPointer>
#include "vvToolBase.h"
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:
#include "vvToolBase.h"
// qt
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QTreeWidget>
//------------------------------------------------------------------------------
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);
#define VVTOOLSEGMENTATION_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
#define VVTOOLSIMPLEINPUTSELECTORWIDGET_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include <QDialog>
#include "ui_vvToolSimpleInputSelectorWidget.h"
#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"
#define VVTOOLWIDGETBASE_H
#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+#include <QtUiPlugin/QDesignerExportWidget>
+#else
#include <QtDesigner/QDesignerExportWidget>
+#endif
#include "ui_vvToolWidgetBase.h"
#include "clitkImageToImageGenericFilter.h"