-/*=========================================================================
+/*========================================================================
Program: vv http://www.creatis.insa-lyon.fr/rio/vv
Authors belong to:
//typedef typename InputImageType::ImageDimension Dimension;
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
bool threadsGiven=m_ArgsInfo.threads_given;
int threads=m_ArgsInfo.threads_arg;
#endif
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
if (threadsGiven) metric->SetNumberOfThreads( threads );
#else
if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<<std::endl;
// Crop the fixedImage to the bounding box to facilitate multi-resolution
typedef itk::ExtractImageFilter<FixedImageType,FixedImageType> ExtractImageFilterType;
typename ExtractImageFilterType::Pointer extractImageFilter=ExtractImageFilterType::New();
+#if ITK_VERSION_MAJOR == 4
+ extractImageFilter->SetDirectionCollapseToSubmatrix();
+#endif
extractImageFilter->SetInput(fixedImage);
extractImageFilter->SetExtractionRegion(transformRegion);
extractImageFilter->Update();
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
if (threadsGiven) {
metric->SetNumberOfThreads( threads );
if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl;
typename FixedImageType::Pointer m_FixedImage;
typename FixedImageMaskType::ConstPointer m_FixedImageMask;
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
FixedImagePixelType m_FixedImageSamplesIntensityThreshold;
bool m_UseFixedImageSamplesIntensityThreshold;
#endif
m_Maximize=false;
m_Verbose=false;
m_FixedImageRegionGiven=false;
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
m_FixedImageSamplesIntensityThreshold=0;
m_UseFixedImageSamplesIntensityThreshold=false;
#endif
//m_Metric->SetFixedImageRegion(mask_region);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
//============================================================================
// Set the lower intensity threshold
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetric.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetric.txx"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx"
#else
#ifndef __clitkOptNormalizedCorrelationImageToImageMetric_h
#define __clitkOptNormalizedCorrelationImageToImageMetric_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
}
// Jacobian should be evaluated at the unmapped (fixed image) point.
+#if ITK_VERSION_MAJOR >= 4
+ TransformJacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters(fixedImagePoint, jacobian);
+#else
const TransformJacobianType & jacobian = transform
->GetJacobian( fixedImagePoint );
+#endif
for(unsigned int par=0; par<this->m_NumberOfParameters; par++) {
RealType sumF = itk::NumericTraits< RealType >::Zero;
#ifndef __clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h
#define __clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
}
// Jacobian should be evaluated at the unmapped (fixed image) point.
+#if ITK_VERSION_MAJOR >= 4
+ TransformJacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters( fixedImagePoint, jacobian );
+#else
const TransformJacobianType & jacobian = transform->GetJacobian( fixedImagePoint );
+#endif
// for(unsigned int par=0; par<this->m_NumberOfParameters; par++)
// {
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
if (threadsGiven) metric->SetNumberOfThreads( threads );
#else
if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<<std::endl;
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx"
#else
#ifndef __itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD_h
#define __itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
transform = this->m_Transform;
}
+#if ITK_VERSION_MAJOR >= 4
+ JacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters(this->m_FixedImageSamples[sampleNumber].point, jacobian);
+#else
const JacobianType& jacobian =
transform->GetJacobian( this->m_FixedImageSamples[sampleNumber].point );
+#endif
// for ( unsigned int mu = 0; mu < this->m_NumberOfParameters; mu++ )
// {
indicesHelper = &(this->m_BSplineTransformIndices);
}
+#if ITK_VERSION_MAJOR >= 4
+ this->m_BSplineTransform->ComputeJacobianFromBSplineWeightsWithRespectToPosition(
+ this->m_FixedImageSamples[sampleNumber].point,
+ *weightsHelper, *indicesHelper );
+#else
this->m_BSplineTransform->GetJacobian(
this->m_FixedImageSamples[sampleNumber].point,
*weightsHelper, *indicesHelper );
+#endif
}
for( unsigned int dim = 0; dim < Superclass::FixedImageDimension; dim++ ) {
#ifndef __itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD_h
#define __itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
}
// Jacobian should be evaluated at the unmapped (fixed image) point.
+#if ITK_VERSION_MAJOR >= 4
+ TransformJacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters(this->m_FixedImageSamples[fixedImageSample].point, jacobian);
+#else
const TransformJacobianType & jacobian = transform ->GetJacobian( this->m_FixedImageSamples[fixedImageSample].point );
+#endif
//double sum;
unsigned int par, dim;
for( par=0; par<this->m_NumberOfParameters; par+=3) {
TARGET_LINK_LIBRARIES(toolTestRunner vvLib ${vvExternalLibs})
SET(exe ${EXECUTABLE_OUTPUT_PATH}/toolTestRunner)
SET(p ${CLITK_TEST_DATA_PATH})
-SET(tmpFile "feve51zd")
#=========================================================
# clitkImageInfo
ADD_TEST(clitkImageInfo_4d ${exe} clitkImageInfo ${p}Deformation4D.mhd ${p}Deformation4D_ref.info)
ADD_TEST(clitkBinarizeBGl0.1356_4d ${exe} clitkBinarizeImage -i ${p}Deformation4D.mhd --mode BG -l 0.1356 -o Deformation4D_ref.binarizeBGl0.1356.mhd ${p}Deformation4D_ref.binarizeBGl0.1356)
ADD_TEST(clitkBinarizeFGl0.1556_3d ${exe} clitkBinarizeImage -i ${p}Lung3D.mhd --mode FG -l 0.1556 -o Lung3D_ref.binarizeFGl0.1556.mhd ${p}Lung3D_ref.binarizeFGl0.1556)
-UNSET(tmpFile)
UNSET(exe)
-UNSET(p)
\ No newline at end of file
+UNSET(p)
+
exit(1);
}
}
+
+#ifdef _WIN32
+void dosToUnixFile(std::string dosFile, std::string unixedFile){
+
+ std::ifstream ifile(dosFile.c_str(),std::ios::binary);
+ ifile.seekg(0,std::ios_base::end);
+ long s=ifile.tellg();
+ char *buffer=new char[s];
+ ifile.seekg(0);
+ ifile.read(buffer,s);
+ ifile.close();
+ std::string txt(buffer,s);
+ delete[] buffer;
+ size_t off=0;
+ while ((off=txt.find("\r\n",off))!=std::string::npos)
+ txt.replace(off,sizeof("\r\n")-1,"\n");
+ std::ofstream ofile(unixedFile.c_str());
+ ofile.write(txt.c_str(),txt.size());
+
+}
+#endif
/**
* argv
* [1] executable
//run the command line
system(cmd_line.str().c_str());
- //compare source files
- assertFalse((itksys::SystemTools::FilesDiffer(outFile.c_str(), refFile)), "Source Files are different");
- //eventually raw files associated
- //should be passed as a boolean to check also for raw or not
+ //compare source files
+#ifdef _WIN32
+ std::string unixedOutFile= getTmpFileName();
+ //replace \r\n
+ dosToUnixFile(outFile, unixedOutFile);
+ assertFalse((itksys::SystemTools::FilesDiffer(unixedOutFile.c_str(), refFile)), "Generated mhd file != ref File");
+ remove(unixedOutFile.c_str());
+#else
+ assertFalse((itksys::SystemTools::FilesDiffer(outFile.c_str(), refFile)), "Generated mhd file != ref File");
+#endif
+
+ //eventually raw files associated
+ //should be passed as a boolean to check also for raw or not
std::string refRawFile = std::string(refFile)+".raw";
-
-
+
int found=outFile.find_last_of(".");
std::string rawFile = outFile.substr(0, found)+".raw";
if((itksys::SystemTools::FileExists(refRawFile.c_str(), true))){
//success
return 0;
}
+
+
vvToolResample
# vvToolExtractPatient
# vvToolExtractLung
- vvToolStructureSetManager
+#vvToolStructureSetManager
vvToolMIP
vvToolConvert ## with dummy vvToolConvert.ui
vvThreadedFilter.cxx
vvImageContour.cxx
vvBinaryImageOverlayActor.cxx
- vvStructureSetActor.cxx
+ #vvStructureSetActor.cxx
vvROIActor.cxx
vvBlendImageActor.cxx
vvToolManager.cxx
vvQDicomSeriesSelector.h
vvSlicerManager.h
vvThreadedFilter.h
- vvStructureSetActor.h
+ #vvStructureSetActor.h
vvROIActor.h
vvToolCreatorBase.h
)
<rect>
<x>0</x>
<y>0</y>
- <width>342</width>
+ <width>344</width>
<height>480</height>
</rect>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QGridLayout" name="fusionGridLayout">
+ <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="maximumSize">
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
+ <item row="0" column="1">
<widget class="QLabel" name="dataFusionnedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
</property>
</widget>
</item>
- <item row="1" column="0" colspan="3">
+ <item row="1" column="0" colspan="2">
<widget class="QLabel" name="opacityLabel">
<property name="text">
<string>Global Opacity :</string>
</property>
</widget>
</item>
+ <item row="1" column="6">
+ <widget class="QDoubleSpinBox" name="fusionOpacitySpin">
+ <property name="decimals">
+ <number>2</number>
+ </property>
+ <property name="minimum">
+ <double>0.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>100.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ </item>
<item row="2" column="0" colspan="3">
<widget class="QLabel" name="thresOpacityLabel">
<property name="toolTip">
</property>
</widget>
</item>
+ <item row="2" column="6">
+ <widget class="QDoubleSpinBox" name="fusionThresSpin">
+ <property name="decimals">
+ <number>2</number>
+ </property>
+ <property name="minimum">
+ <double>0.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>100.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>0.000000000000000</double>
+ </property>
+ </widget>
+ </item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
</property>
</widget>
</item>
- <item row="4" column="5">
+ <item row="4" column="5" colspan="2">
<widget class="QDoubleSpinBox" name="fusionLevelSpinBox">
<property name="decimals">
<number>4</number>
</widget>
<resources>
<include location="../vvIcons.qrc"/>
- <include location="vvIcons.qrc"/>
</resources>
<connections/>
</ui>
class vvSlicerManager;
class QMenu;
+class QTabWidget;
//------------------------------------------------------------------------------
class vvMainWindowBase : public QMainWindow
connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
connect(fusionWindowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
connect(fusionLevelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
+ connect(fusionOpacitySpin,SIGNAL(valueChanged(double)),this,SLOT(setFusionSpinProperty()));
+ connect(fusionThresSpin,SIGNAL(valueChanged(double)),this,SLOT(setFusionSpinProperty()));
connect(overlayWindowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setOverlayProperty()));
connect(overlayLevelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setOverlayProperty()));
connect(overlayLinkCheckBox,SIGNAL(stateChanged(int)),this,SLOT(setOverlayProperty()));
if (disableFusionSignals)
return;
+ fusionOpacitySpin->setValue(opacityHorizontalSlider->value());
+ fusionThresSpin->setValue(thresOpacityHorizontalSlider->value());
+
emit FusionPropertyUpdated(opacityHorizontalSlider->value(), thresOpacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
fusionWindowSpinBox->value(), fusionLevelSpinBox->value());
}
+void vvOverlayPanel::setFusionSpinProperty()
+{
+ opacityHorizontalSlider->setValue(fusionOpacitySpin->value());
+ thresOpacityHorizontalSlider->setValue(fusionThresSpin->value());
+}
+
void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
{
QString fusionValue = "<b>Pixel value in image 2 : </b>";
void setVFProperty();
void setOverlayProperty();
void setFusionProperty();
+ void setFusionSpinProperty();
void VFColorChangeRequest();
signals:
vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
if ( LUT ) {
double level = this->GetWindowLevel()->GetLevel();
- LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
+ LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
LUT->Build();
}
this->vtkImageViewer2::SetColorWindow(window);
vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
if ( LUT ) {
double window = this->GetWindowLevel()->GetWindow();
- LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
+ LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
LUT->Build();
}
this->vtkImageViewer2::SetColorLevel(level);
break;
}
if (LUT) {
- LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
+ LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
LUT->Build();
}
vtkWindowLevelLookupTable* fusLUT = NULL;
#include "vvToolBaseBase.h"
#include "vvToolCreator.h"
+#include <QIcon>
//------------------------------------------------------------------------------
template<class ToolType>
#include <QMessageBox>
#include <QKeyEvent>
#include <QDockWidget>
+#include <QTabWidget>
//------------------------------------------------------------------------------
// Static initialisation