cmake_policy(VERSION 2.8)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
+ #cmake_policy(SET CMP0007 NEW)
endif(COMMAND cmake_policy)
if(NOT DEFINED CLITK_SOURCE_DIR)
set(CLITK_SOURCE_DIR ${PROJECT_SOURCE_DIR})
endif(NOT DEFINED CLITK_SOURCE_DIR)
#=========================================================
-SET(QT_MIN_VERSION "5.0.0")
-SET(VTK_MIN_VERSION "6.0.0")
+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(MSVC)
option(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
option(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
+
if(CLITK_BUILD_VV)
+ set(vv_QT_VERSION "4" CACHE STRING "Expected Qt version")
+ set_property(CACHE vv_QT_VERSION PROPERTY STRINGS 4 5)
+ if(NOT (vv_QT_VERSION VERSION_EQUAL "4" OR vv_QT_VERSION VERSION_EQUAL "5"))
+ message(FATAL_ERROR "Expected value for vv_QT_VERSION is either '4' or '5'")
+ endif()
+
add_subdirectory(${CLITK_SOURCE_DIR}/vv ${PROJECT_BINARY_DIR}/vv)
endif(CLITK_BUILD_VV)
# To avoid warning with some version
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
+ #cmake_policy(SET CMP0007 NEW)
endif(COMMAND cmake_policy)
#=========================================================
#=========================================================
# Qt related commands
+if(vv_QT_VERSION VERSION_GREATER "4")
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Designer REQUIRED)
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
+else()
+find_package(Qt4 REQUIRED)
+link_directories(${QT_LIBRARY_DIR})
+
+
+QT4_WRAP_CPP(vv_SRCS
+ vvMainWindowBase.h
+ QTreePushButton.h
+ vvDocumentation.h
+ vvHelpDialog.h
+ vvQDicomSeriesSelector.h
+ vvSlicerManager.h
+ vvStructureSetActor.h
+ vvROIActor.h
+ vvToolCreatorBase.h
+ )
+
+QT4_WRAP_UI(vv_UI_CXX
+ qt_ui/vvHelpDialog.ui
+ qt_ui/vvDocumentation.ui
+ qt_ui/vvDicomSeriesSelector.ui
+ qt_ui/vvDummyWindow.ui #For testing
+ )
+
+QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
+
+# Add the autotools in the header vvToolsList.h for initialization of the dummy
+# variables in vv.cxx for the tools contained in vvLib
+if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
+ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
+ foreach(tool ${vv_TOOLS})
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
+ endforeach(tool)
+endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
+
+# Add the autotools and the common files ui
+foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
+ set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
+ QT4_WRAP_CPP(vv_SRCS ${tool}.h)
+ QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
+endforeach(tool)
+
+# Add the common source files
+foreach(tool ${vv_COMMON})
+ set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
+ QT4_WRAP_CPP(vv_SRCS ${tool}.h)
+endforeach(tool)
+
+# if Windows and Qt was built as a static lib then don't set QT_DLL flag
+set(QT_STATIC 0)
+if(WIN32)
+ if(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
+ file(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL)
+ if(${QT_CORE_PRL} MATCHES "static")
+ set(QT_STATIC 1)
+ endif(${QT_CORE_PRL} MATCHES "static")
+ endif(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
+endif(WIN32)
+if(NOT QT_STATIC)
+ add_definitions(-DQT_DLL)
+endif(NOT QT_STATIC)
+
+add_definitions(-DQT_THREAD_SUPPORT)
+
+include_directories(
+ ${QT_INCLUDES}
+ ${QT_INCLUDE_DIR}
+ ${QT_QTGUI_INCLUDE_DIR}
+ ${QT_QTCORE_INCLUDE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+endif()
#=========================================================
#=========================================================
#=========================================================
#Add Foundation Libraries (this should be after our libraries, since we depend
#on them)
-#set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
+if(vv_QT_VERSION VERSION_GREATER "4")
set(foundationLibraries clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES})
+else()
+set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
+endif()
#=========================================================
# Use CxImage to create animated gifs
endif()
#=========================================================
#Create binary and libs for tests
-#set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${Qt5Widgets_LIBRARIES_DIRS} ${Qt5Network_LIBRARIES_DIRS} ${APPLE_FRAMEWORKS})
+if(vv_QT_VERSION VERSION_GREATER "4")
set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} Qt5::Widgets Qt5::Network Qt5::Designer ${APPLE_FRAMEWORKS})
+else()
+set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARY} ${APPLE_FRAMEWORKS})
+endif()
# QtNetwork is required by vvRegisterForm
add_library(vvLib ${vv_SRCS} ${vv_UI_CXX})
#define VVINTENSITYVALUESLIDER_H
// qt
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QDialog>
// clitk
#include "vvImage.h"
// qt
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QDialog>
#include "ui_vvLabelImageLoaderWidget.h"
#include "vvRegisterForm.h"
#include <QNetworkRequest>
#include <QDir>
+#if QT_VERSION >= 0x050000
#include <QUrlQuery>
+#endif
#include <QPalette>
#include "clitkConfiguration.h"
#include "vvConfiguration.h"
void vvRegisterForm::sendData(){
QUrl url2(url);
+
+#if QT_VERSION < 0x050000
+ url2.addQueryItem("name", firstName->text().toUtf8());
+ url2.addQueryItem("lastName", lastName->text().toUtf8());
+ url2.addQueryItem("email", email->text().toUtf8());
+ url2.addQueryItem("group", group->text().toUtf8());
+ url2.addQueryItem("os", OS_NAME);
+ url2.addQueryItem("vvVersion", VV_VERSION);
+ url2.addQueryItem("architecture", ARCHITECTURE);
+ url2.addQueryItem("adressing", QString::number(sizeof(char*)*8)+"-bit");
+ url2.addQueryItem("compilationDate", QString(__DATE__) + ", " + QString(__TIME__) );
+#else
QUrlQuery url2Query;
url2Query.addQueryItem("name", firstName->text().toUtf8());
url2Query.addQueryItem("adressing", QString::number(sizeof(char*)*8)+"-bit");
url2Query.addQueryItem("compilationDate", QString(__DATE__) + ", " + QString(__TIME__) );
url2.setQuery(url2Query);
+#endif
manager->get(QNetworkRequest(url2));
}
#include "vtkPolyData.h"
#include <vtkPolyDataMapper.h>
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QTreeWidget>
//====================================================================
// Local copy of extent
int w_ext[6];
+#if VTK_MAJOR_VERSION <= 5
+ int* ext = GetExtent();
+#else
int* ext = mImageReslice->GetOutputInformation(0)->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
+#endif
copyExtent(ext, w_ext);
if (mUseReducedExtent) {
copyExtent(mReducedExtent, w_ext);
if (mOverlay && mOverlayVisibility) {
AdjustResliceToSliceOrientation(mOverlayReslice);
int overExtent[6];
- this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mOverlayReslice->GetOutput(), overExtent);
#if VTK_MAJOR_VERSION <= 5
+ this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent);
bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
#else
+ this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mOverlayReslice->GetOutput(), overExtent);
bool out = ClipDisplayedExtent(overExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
mOverlayActor->SetVisibility(!out);
if (mFusion && mFusionVisibility) {
AdjustResliceToSliceOrientation(mFusionReslice);
int fusExtent[6];
- this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mFusionReslice->GetOutput(), fusExtent);
#if VTK_MAJOR_VERSION <= 5
+ this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent);
bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
#else
+ this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mFusionReslice->GetOutput(), fusExtent);
bool out = ClipDisplayedExtent(fusExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
mFusionActor->SetVisibility(!out);
int vfExtent[6];
#if VTK_MAJOR_VERSION <= 5
mVF->GetVTKImages()[0]->UpdateInformation();
+ this->ConvertImageToImageDisplayExtent(input, w_ext, mVF->GetVTKImages()[0], vfExtent);
+ bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
#else
//this->UpdateInformation();
-#endif
this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mVF->GetVTKImages()[0], vfExtent);
-#if VTK_MAJOR_VERSION <= 5
- bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
-#else
bool out = ClipDisplayedExtent(vfExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
mVFActor->SetVisibility(!out);
}
//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+void vvSlicer::ConvertImageToImageDisplayExtent(vtkImageData *sourceImage, const int sourceExtent[6],
+ vtkImageData *targetImage, int targetExtent[6])
+{
+ double dExtents[6];
+ for(unsigned int i=0; i<6; i++) {
+ // From source voxel coordinates to world coordinates
+ dExtents[i] = sourceImage->GetOrigin()[i/2] + sourceImage->GetSpacing()[i/2] * sourceExtent[i];
+
+ // From world coordinates to floating point target voxel coordinates
+ dExtents[i] = (dExtents[i]- targetImage->GetOrigin()[i/2]) / targetImage->GetSpacing()[i/2];
+
+ // Round to current slice or larger extent
+ if(i/2==this->GetOrientation())
+ targetExtent[i] = itk::Math::Round<double>(dExtents[i]);
+ else if(i%2==1)
+ targetExtent[i] = itk::Math::Ceil<double>(dExtents[i]);
+ else
+ targetExtent[i] = itk::Math::Floor<double>(dExtents[i]);
+ }
+}
+//----------------------------------------------------------------------------
+
//----------------------------------------------------------------------------
bool vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
{
void UpdateDisplayExtent();
void ConvertImageToImageDisplayExtent(vtkInformation *sourceImage, const int sourceExtent[6],
vtkImageData *targetImage, int targetExtent[6]);
+ void ConvertImageToImageDisplayExtent(vtkImageData *sourceImage, const int sourceExtent[6],
+ vtkImageData *targetImage, int targetExtent[6]);
///Sets the surfaces to be cut on the image slice: update the vtkCutter
void SetContourSlice();
class vtkActor;
class vtkOBJReader;
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QTreeWidget>
//====================================================================
#ifndef VVTOOLBINARIZE_H
#define VVTOOLBINARIZE_H
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
#define VVTOOLCROPIMAGE_H
//qt
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QDialog>
#include <QSlider>
// vv
===========================================================================**/
#ifndef VVTOOLImageArithm_H
#define VVTOOLImageArithm_H
+
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
#define VVTOOLINPUTSELECTORWIDGET_H
// qt
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QDialog>
// vv
#include <vvImage.h>
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "QWidget"
#include "vvToolWidgetBase.h"
#ifndef VVTOOLMedianFilter_H
#define VVTOOLMedianFilter_H
-
+
+#if QT_VERSION < 0x050000
+ #include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "QWidget"
#include "vvToolWidgetBase.h"
#ifndef VVTOOLPROFILE_H
#define VVTOOLPROFILE_H
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
#ifndef VVTOOLROIMANAGER_H
#define VVTOOLROIMANAGER_H
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QSharedPointer>
#include "vvToolBase.h"
#include "vvToolBase.h"
// qt
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QTreeWidget>
//------------------------------------------------------------------------------
#ifndef VVTOOLSEGMENTATION_H
#define VVTOOLSEGMENTATION_H
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "vvToolBase.h"
#include "vvToolWidgetBase.h"
===========================================================================**/
#ifndef VVTOOLSIMPLEINPUTSELECTORWIDGET_H
#define VVTOOLSIMPLEINPUTSELECTORWIDGET_H
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include <QDialog>
#include "ui_vvToolSimpleInputSelectorWidget.h"
#ifndef VVTOOLWIDGETBASE_H
#define VVTOOLWIDGETBASE_H
+#if QT_VERSION < 0x050000
+#include <QtDesigner/QDesignerExportWidget>
+#else
#include <QtUiPlugin/QDesignerExportWidget>
+#endif
#include "ui_vvToolWidgetBase.h"
#include "clitkImageToImageGenericFilter.h"