Skip to content
Commits on Source (4)
......@@ -33,4 +33,9 @@
/* Legacy (for backwards compatibility) */
#define DICOM_BUILD_VERSION DICOM_PATCH_VERSION
/* To support 'override' for C++11 compilers */
#define VTK_DICOM_OVERRIDE@DICOM_OVERRIDE@
/* To support '=delete' for C++11 compilers */
#define VTK_DICOM_DELETE@DICOM_DELETE@
#endif
......@@ -14,7 +14,7 @@ include(CTest)
# Project version
set(DICOM_MAJOR_VERSION 0)
set(DICOM_MINOR_VERSION 8)
set(DICOM_PATCH_VERSION 9)
set(DICOM_PATCH_VERSION 10)
set(DICOM_SHORT_VERSION "${DICOM_MAJOR_VERSION}.${DICOM_MINOR_VERSION}")
set(DICOM_VERSION "${DICOM_SHORT_VERSION}.${DICOM_PATCH_VERSION}")
......@@ -29,8 +29,24 @@ set(DICOM_INCLUDE_DIRS
"${DICOM_SOURCE_DIR}/Source"
"${DICOM_BINARY_DIR}/Source")
if(Module_vtkDICOM) # We are being built as a VTK remote module
if(DEFINED VTK_MODULE_ENABLE_VTK_DICOM)
# When building as a remote module for VTK 9 (or VTK 8.90+)
message(STATUS "vtkDICOM: Building vtkDICOM as a Remote VTK Module")
# Clear VTK_LIBS, linking will be handled by modular build
set(VTK_LIBS)
set(VTK_DICOM_LINK_TARGET VTK::DICOM)
# To set DICOM_USE_VTKZLIB in vtkDICOMConfig.h
set(DICOM_USE_VTKZLIB ON)
option(BUILD_DICOM_PROGRAMS "Build the vtkDICOM tools" OFF)
option(BUILD_DICOM_EXAMPLES "Build the vtkDICOM examples" OFF)
set(BUILD_PROGRAMS ${BUILD_DICOM_PROGRAMS})
set(BUILD_EXAMPLES ${BUILD_DICOM_EXAMPLES})
elseif(Module_vtkDICOM)
# When building as a remote module for older versions of VTK
message(STATUS "vtkDICOM: Building vtkDICOM as a Remote VTK Module")
set(vtkDICOM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Source)
set(vtkDICOM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Source)
......@@ -38,14 +54,19 @@ if(Module_vtkDICOM) # We are being built as a VTK remote module
# Clear VTK_LIBS, linking will be handled by modular build
set(VTK_LIBS)
set(VTK_DICOM_LINK_TARGET vtkDICOM)
# To set DICOM_USE_VTKZLIB in vtkDICOMConfig.h
set(DICOM_USE_VTKZLIB ON)
option(BUILD_DICOM_PROGRAMS "Build the vtkDICOM tools" ON)
option(BUILD_DICOM_EXAMPLES "Build the vtkDICOM examples" OFF)
set(BUILD_PROGRAMS ${BUILD_DICOM_PROGRAMS})
set(BUILD_EXAMPLES ${BUILD_DICOM_EXAMPLES})
else() # We are being built as a stand-alone package
else()
# We are being built as a stand-alone package
set(VTK_DICOM_LINK_TARGET vtkDICOM)
# When CMake 3.0.0 is required, remove this block (see CMP0042).
if(NOT DEFINED CMAKE_MACOSX_RPATH)
......@@ -61,14 +82,28 @@ else() # We are being built as a stand-alone package
find_package(VTK REQUIRED)
message(STATUS "vtkDICOM: Building vtkDICOM stand-alone")
if(NOT DEFINED VTK_VERSION)
# backwards compatibility pre VTK 9.x
set(VTK_VERSION ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION})
endif()
if(VTK_VERSION VERSION_LESS 8.90)
include(${VTK_USE_FILE})
if("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_LESS 5.8)
endif()
if(VTK_VERSION VERSION_LESS 5.8)
message(FATAL_ERROR "VTK 5.8 or later is required.")
endif()
# Wrap Python option
if(VTK_WRAP_PYTHON)
if(VTK_VERSION VERSION_LESS 8.90)
option(BUILD_PYTHON_WRAPPERS "Build python wrappers" ON)
else()
message(WARNING
"Stand-alone vtkDICOMPython not yet supported for "
"VTK ${VTK_VERSION}, try building vtk-dicom as a remote "
"module instead.")
unset(BUILD_PYTHON_WRAPPERS CACHE)
endif()
else()
unset(BUILD_PYTHON_WRAPPERS CACHE)
endif()
......@@ -82,7 +117,15 @@ else() # We are being built as a stand-alone package
# Wrap Java option
if(VTK_WRAP_JAVA)
option(BUILD_JAVA_WRAPPERS "Build java wrappers" OFF)
if(VTK_VERSION VERSION_LESS 8.90)
option(BUILD_PYTHON_WRAPPERS "Build python wrappers" ON)
else()
message(WARNING
"Stand-alone vtkDICOMJava not yet supported for "
"VTK ${VTK_VERSION}, try building vtk-dicom as a remote "
"module instead.")
unset(BUILD_JAVA_WRAPPERS CACHE)
endif()
else()
unset(BUILD_JAVA_WRAPPERS CACHE)
endif()
......@@ -258,14 +301,23 @@ if(NOT Module_vtkDICOM)
set(DICOM_LIBRARIES vtkDICOM)
# The library dependencies
if("${VTK_MAJOR_VERSION}" GREATER 5)
set(VTK_LIBS vtkCommonCore vtkCommonDataModel vtkImagingCore vtkIOCore
vtkIOImage)
# If vtkIOMPIImage is present, it has factories for vtkIOImage
list(FIND VTK_LIBRARIES vtkIOMPIImage TMP_INDEX)
if(TMP_INDEX GREATER -1)
set(VTK_LIBS ${VTK_LIBS} vtkIOMPIImage)
if(NOT VTK_VERSION VERSION_LESS 6)
set(VTK_TARGET_PREFIX "VTK::")
if(VTK_VERSION VERSION_LESS 8.90)
set(VTK_TARGET_PREFIX "vtk")
endif()
set(VTK_LIBS)
# required libraries
foreach(_lib CommonCore CommonMisc CommonDataModel ImagingCore IOCore IOImage)
list(APPEND VTK_LIBS ${VTK_TARGET_PREFIX}${_lib})
endforeach()
# factory libraries (only needed if present)
foreach(_lib IOMPIImage)
list(FIND VTK_LIBRARIES ${VTK_TARGET_PREFIX}${_lib} _index)
if(_index GREATER -1)
list(APPEND VTK_LIBS ${VTK_TARGET_PREFIX}${_lib})
endif()
endforeach()
else()
set(VTK_LIBS vtkCommon vtkFiltering vtkImaging vtkIO vtkInfovis) # VTK 5.x
endif()
......@@ -335,20 +387,24 @@ if(BUILD_PROGRAMS)
add_subdirectory(Programs)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(Examples)
endif()
if(NOT DEFINED VTK_MODULE_ENABLE_VTK_DICOM)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(Testing)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(Examples)
endif()
# Install files
install(FILES Copyright.txt
DESTINATION ${DICOM_DATA_INSTALL_DEST})
if(NOT Module_vtkDICOM)
endif()
if(NOT Module_vtkDICOM AND NOT DEFINED VTK_MODULE_ENABLE_VTK_DICOM)
#---------------------------------------------------
# Export information for other projects
......
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
include_directories(${DICOM_INCLUDE_DIRS})
set(LIB_NAME dicomcli)
......@@ -16,4 +20,4 @@ set(LIB_SRCS
)
add_library(${LIB_NAME} STATIC ${LIB_SRCS})
target_link_libraries(${LIB_NAME} vtkDICOM)
target_link_libraries(${LIB_NAME} ${VTK_DICOM_LINK_TARGET})
......@@ -15,6 +15,7 @@
#define progress_h
#include "vtkCommand.h"
#include "vtkDICOMConfig.h"
// Capture progress events
class ProgressObserver : public vtkCommand
......@@ -22,12 +23,9 @@ class ProgressObserver : public vtkCommand
public:
static ProgressObserver *New() { return new ProgressObserver; }
vtkTypeMacro(ProgressObserver,vtkCommand);
#ifdef VTK_OVERRIDE
void Execute(
vtkObject *caller, unsigned long eventId, void *callData) VTK_OVERRIDE;
#else
void Execute(vtkObject *caller, unsigned long eventId, void *callData);
#endif
vtkObject *caller, unsigned long eventId, void *callData)
VTK_DICOM_OVERRIDE;
void SetText(const char *text) { this->Text = text; }
protected:
ProgressObserver() : Stage(0), Anim(0), LastTime(0), Text("") {}
......
......@@ -22,19 +22,15 @@
#define vtkConsoleOutputWindow_h
#include "vtkOutputWindow.h"
#include "vtkDICOMConfig.h"
class vtkConsoleOutputWindow : public vtkOutputWindow
{
public:
vtkTypeMacro(vtkConsoleOutputWindow, vtkOutputWindow);
static vtkConsoleOutputWindow* New();
#ifdef VTK_OVERRIDE
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
void DisplayText(const char*) VTK_OVERRIDE;
#else
void PrintSelf(ostream& os, vtkIndent indent);
void DisplayText(const char*);
#endif
void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
void DisplayText(const char*) VTK_DICOM_OVERRIDE;
static void Install();
protected:
......@@ -43,12 +39,12 @@ protected:
void Initialize();
private:
#ifdef VTK_DELETE_FUNCTION
vtkConsoleOutputWindow(const vtkConsoleOutputWindow&) VTK_DELETE_FUNCTION;
void operator=(const vtkConsoleOutputWindow&) VTK_DELETE_FUNCTION;
#ifdef VTK_DICOM_DELETE
vtkConsoleOutputWindow(const vtkConsoleOutputWindow&) VTK_DICOM_DELETE;
void operator=(const vtkConsoleOutputWindow&) VTK_DICOM_DELETE;
#else
vtkConsoleOutputWindow(const vtkConsoleOutputWindow&);
void operator=(const vtkConsoleOutputWindow&);
vtkConsoleOutputWindow(const vtkConsoleOutputWindow&) = delete;
void operator=(const vtkConsoleOutputWindow&) = delete;
#endif
};
......
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
include_directories(${DICOM_INCLUDE_DIRS})
if("${VTK_MAJOR_VERSION}" GREATER 5)
set(VTK_RENDERING_LIBS vtkRenderingImage vtkInteractionStyle
vtkRenderingFreeType) # VTK 6.x
set(VTK_GL_LIBS vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL
vtkRenderingOpenGL2 vtkRenderingFreeTypeOpenGL2)
foreach(TMP_LIB ${VTK_GL_LIBS})
list(FIND VTK_LIBRARIES ${TMP_LIB} TMP_INDEX)
if(TMP_INDEX GREATER -1)
set(VTK_RENDERING_LIBS ${VTK_RENDERING_LIBS} ${TMP_LIB})
if(NOT VTK_VERSION VERSION_LESS 6)
set(VTK_RENDERING_LIBS)
foreach(_lib RenderingImage InteractionStyle RenderingFreeType)
list(APPEND VTK_RENDERING_LIBS ${VTK_TARGET_PREFIX}${_lib})
endforeach()
foreach(_lib RenderingOpenGL RenderingFreeTypeOpenGL
RenderingOpenGL2 RenderingFreeTypeOpenGL2)
list(FIND VTK_LIBRARIES ${VTK_TARGET_PREFIX}${_lib} _index)
if(_index GREATER -1)
list(APPEND VTK_RENDERING_LIBS ${VTK_TARGET_PREFIX}${_lib})
endif()
endforeach()
else()
set(VTK_RENDERING_LIBS vtkRendering) # VTK 5.x
endif()
set(BASE_LIBS vtkDICOM ${VTK_LIBS})
set(BASE_LIBS ${VTK_DICOM_LINK_TARGET} ${VTK_LIBS})
add_executable(TestDICOMCompiler TestDICOMCompiler.cxx)
target_link_libraries(TestDICOMCompiler ${BASE_LIBS})
......@@ -38,16 +43,29 @@ target_link_libraries(TestDICOMWriter ${BASE_LIBS})
add_executable(TestDICOMRealWorldValue TestDICOMRealWorldValue.cxx)
target_link_libraries(TestDICOMRealWorldValue ${BASE_LIBS})
if(VTK_MAJOR_VERSION GREATER 5 OR VTK_MINOR_VERSION GREATER 9)
if(VTK_VERSION VERSION_GREATER 5.9)
add_executable(TestDICOMDisplay TestDICOMDisplay.cxx)
target_link_libraries(TestDICOMDisplay ${BASE_LIBS} ${VTK_RENDERING_LIBS})
if(NOT VTK_VERSION VERSION_LESS 8.90)
vtk_module_autoinit(TARGETS TestDICOMDisplay MODULES ${VTK_RENDERING_LIBS})
endif()
add_executable(TestDICOMOverlay TestDICOMOverlay.cxx)
target_link_libraries(TestDICOMOverlay ${BASE_LIBS} ${VTK_RENDERING_LIBS})
if(NOT VTK_VERSION VERSION_LESS 8.90)
vtk_module_autoinit(TARGETS TestDICOMOverlay MODULES ${VTK_RENDERING_LIBS})
endif()
add_executable(TestNIFTIDisplay TestNIFTIDisplay.cxx)
target_link_libraries(TestNIFTIDisplay ${BASE_LIBS} ${VTK_RENDERING_LIBS})
if(NOT VTK_VERSION VERSION_LESS 8.90)
vtk_module_autoinit(TARGETS TestNIFTIDisplay MODULES ${VTK_RENDERING_LIBS})
endif()
add_executable(TestScancoCTDisplay TestScancoCTDisplay.cxx)
target_link_libraries(TestScancoCTDisplay ${BASE_LIBS} ${VTK_RENDERING_LIBS})
if(NOT VTK_VERSION VERSION_LESS 8.90)
vtk_module_autoinit(TARGETS TestScancoCTDisplay MODULES ${VTK_RENDERING_LIBS})
endif()
endif()
......@@ -33,12 +33,8 @@ class vtkDICOMPrinter : public vtkCommand
public:
static vtkDICOMPrinter *New() { return new vtkDICOMPrinter; }
vtkTypeMacro(vtkDICOMPrinter,vtkCommand);
#ifdef VTK_OVERRIDE
void Execute(vtkObject *caller, unsigned long eventId, void *callData)
VTK_OVERRIDE;
#else
void Execute(vtkObject *caller, unsigned long eventId, void *callData);
#endif
VTK_DICOM_OVERRIDE;
protected:
vtkDICOMPrinter() {};
vtkDICOMPrinter(const vtkDICOMPrinter& c) : vtkCommand(c) {}
......
......@@ -28,12 +28,8 @@ public:
static ReaderProgress *New() { return new ReaderProgress; }
#ifdef VTK_OVERRIDE
void Execute(vtkObject *object, unsigned long event, void *data)
VTK_OVERRIDE;
#else
void Execute(vtkObject *object, unsigned long event, void *data);
#endif
VTK_DICOM_OVERRIDE;
};
void ReaderProgress::Execute(
......
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
include_directories(
${DICOM_INCLUDE_DIRS}
${DICOM_SOURCE_DIR}/DicomCli
......@@ -17,13 +21,16 @@ set(PROGRAM_SRCS
scancodump.cxx
)
if("${VTK_MAJOR_VERSION}" GREATER 5)
set(VTK_IMAGING_LIBS vtkImagingStatistics) # VTK 6.x
if(NOT VTK_VERSION VERSION_LESS 6)
set(VTK_EXTRA_LIBS)
foreach(_lib ImagingStatistics CommonSystem)
list(APPEND VTK_EXTRA_LIBS ${VTK_TARGET_PREFIX}${_lib})
endforeach()
else()
set(VTK_IMAGING_LIBS) # VTK 5.x
set(VTK_EXTRA_LIBS) # VTK 5.x
endif()
set(BASE_LIBS vtkDICOM ${VTK_LIBS})
set(BASE_LIBS ${VTK_DICOM_LINK_TARGET} ${VTK_LIBS})
set(CLI_LIBS dicomcli)
......@@ -31,7 +38,7 @@ foreach(src ${PROGRAM_SRCS})
string(REGEX REPLACE "\\.(cxx|c|mm|m)$" "" prog ${src})
add_executable(${prog} ${src})
target_link_libraries(${prog} ${BASE_LIBS} ${CLI_LIBS}
${VTK_IMAGING_LIBS})
${VTK_EXTRA_LIBS})
list(APPEND PROGRAM_EXES ${prog})
endforeach()
......
......@@ -136,12 +136,9 @@ class ErrorObserver : public vtkCommand
public:
static ErrorObserver *New() { return new ErrorObserver(); }
vtkTypeMacro(ErrorObserver,vtkCommand);
#ifdef VTK_OVERRIDE
void Execute(
vtkObject *caller, unsigned long eventId, void *callData) VTK_OVERRIDE;
#else
void Execute(vtkObject *caller, unsigned long eventId, void *callData);
#endif
vtkObject *caller, unsigned long eventId, void *callData)
VTK_DICOM_OVERRIDE;
void SetMetaData(vtkDICOMMetaData *meta) { this->MetaData = meta; }
protected:
ErrorObserver() : MetaData(0) {}
......
......@@ -419,9 +419,9 @@ void dicomtonifti_read_options(
dicomtonifti_usage(stderr, argv[0]);
exit(1);
}
const char *optarg = arg;
const char *optionarg = arg;
arg = argv[argi++];
if (strcmp(optarg, "--time-delta") == 0)
if (strcmp(optionarg, "--time-delta") == 0)
{
if (!dicomtonifti_time_delta(arg, options))
{
......@@ -436,7 +436,7 @@ void dicomtonifti_read_options(
{
exit(1);
}
if (strcmp(optarg, "--time-delta-tag") == 0)
if (strcmp(optionarg, "--time-delta-tag") == 0)
{
options->time_delta_tagpath = qtlist[0];
}
......
......@@ -317,7 +317,7 @@ int MAINMACRO(int argc, char *argv[])
}
else
{
printf(" (freq_dim=%d, phase_dim=%d, slice_dim=%d\n",
printf(" (freq_dim=%d, phase_dim=%d, slice_dim=%d)\n",
(hdr.dim_info & 0x3),
((hdr.dim_info >> 2) & 0x3),
((hdr.dim_info >> 4) & 0x3));
......
......@@ -21,6 +21,7 @@
#include "vtkDICOMFileSorter.h"
#include "vtkDICOMMRGenerator.h"
#include "vtkDICOMCTGenerator.h"
#include "vtkDICOMSCGenerator.h"
#include "vtkDICOMToRAS.h"
#include "vtkDICOMCTRectifier.h"
#include "vtkDICOMUtilities.h"
......@@ -75,6 +76,7 @@ struct niftitodicom_options
int mpr;
bool silent;
bool verbose;
bool verbatim;
const char *output;
const char *input;
};
......@@ -117,6 +119,7 @@ void niftitodicom_usage(FILE *file, const char *command_name)
" -o directory The output directory.\n"
" -s --silent Do not print anything while executing.\n"
" -v --verbose Verbose error reporting.\n"
" --verbatim Copy source metadata nearly verbatim.\n"
" --no-reordering Never reorder slices, rows, or columns.\n"
" --axial Produce axial slices.\n"
" --coronal Produce coronal slices.\n"
......@@ -264,6 +267,7 @@ void niftitodicom_read_options(
options->uid_prefix = "2.25";
options->silent = false;
options->verbose = false;
options->verbatim = false;
options->output = 0;
options->input = 0;
......@@ -332,6 +336,10 @@ void niftitodicom_read_options(
{
options->verbose = true;
}
else if (strcmp(arg, "--verbatim") == 0)
{
options->verbatim = true;
}
else if (strcmp(arg, "--version") == 0)
{
niftitodicom_version(stdout, argv[0], false);
......@@ -746,37 +754,85 @@ void niftitodicom_convert_one(
meta->Erase(DC::FrameOfReferenceUID);
}
// the UIDs for the SOP classes we support
const char *classUID_CT = "1.2.840.10008.5.1.4.1.1.2";
const char *classUID_MR = "1.2.840.10008.5.1.4.1.1.4";
const char *classUID_SC = "1.2.840.10008.5.1.4.1.1.7";
std::string sourceClassUID = meta->Get(DC::SOPClassUID).AsString();
std::string outputClassUID;
// make the generator
vtkSmartPointer<vtkDICOMMRGenerator> mrgenerator =
vtkSmartPointer<vtkDICOMMRGenerator>::New();
vtkSmartPointer<vtkDICOMCTGenerator> ctgenerator =
vtkSmartPointer<vtkDICOMCTGenerator>::New();
vtkSmartPointer<vtkDICOMSCGenerator> scgenerator =
vtkSmartPointer<vtkDICOMSCGenerator>::New();
vtkSmartPointer<vtkDICOMGenerator> verbgenerator =
vtkSmartPointer<vtkDICOMGenerator>::New();
vtkDICOMGenerator *generator = mrgenerator;
if (options->modality)
if (options->verbatim)
{
generator = verbgenerator;
}
else if (options->modality)
{
if (strcmp(options->modality, "CT") == 0)
{
generator = ctgenerator;
outputClassUID = classUID_CT;
}
else if (strcmp(options->modality, "MR") == 0 ||
strcmp(options->modality, "MRI") == 0)
{
generator = mrgenerator;
outputClassUID = classUID_MR;
}
else
else if (strcmp(options->modality, "SC") == 0)
{
generator = scgenerator;
outputClassUID = classUID_SC;
}
}
else if (meta->Has(DC::SOPClassUID))
{
if (sourceClassUID == classUID_CT &&
(scalarType == VTK_SHORT || scalarType == VTK_UNSIGNED_SHORT))
{
generator = ctgenerator;
outputClassUID = classUID_CT;
}
else if (sourceClassUID == classUID_MR &&
(scalarType == VTK_SHORT || scalarType == VTK_UNSIGNED_SHORT))
{
generator = mrgenerator;
outputClassUID = classUID_MR;
}
else if (sourceClassUID == classUID_SC)
{
generator = 0;
generator = scgenerator;
outputClassUID = classUID_SC;
}
}
if (sourceClassUID == outputClassUID)
{
// if the source data has the same SOP base class as the data that we
// are generating, then copy all attributes, otherwise only copy
// attributes that are part of the output's SOP base class.
generator->ExtendedOn();
}
// prepare the writer to write the image
vtkSmartPointer<vtkDICOMWriter> writer =
vtkSmartPointer<vtkDICOMWriter>::New();
if (generator)
{
writer->SetGenerator(generator);
}
writer->SetMetaData(meta);
if (options->verbatim)
{
writer->SetImageType(NULL);
}
writer->SetFilePrefix(outfile);
writer->SetFilePattern("%s/IM-0001-%04.4d.dcm");
writer->TimeAsVectorOn();
......
......@@ -4,6 +4,19 @@ set(DICOM_BUILD_TESTING ${BUILD_TESTING})
set(DICOM_USE_GDCM ${USE_GDCM})
set(DICOM_USE_DCMTK ${USE_DCMTK})
set(DICOM_USE_SQLITE ${USE_SQLITE})
if(VTK_VERSION VERSION_LESS 7.0)
set(DICOM_OVERRIDE "")
set(DICOM_DELETE "")
elseif(VTK_VERSION VERSION_LESS 7.1)
set(DICOM_OVERRIDE " VTK_OVERRIDE")
set(DICOM_DELETE "")
elseif(VTK_VERSION VERSION_LESS 8.90)
set(DICOM_OVERRIDE " VTK_OVERRIDE")
set(DICOM_DELETE " VTK_DELETE_FUNCTION")
else()
set(DICOM_OVERRIDE " override")
set(DICOM_DELETE " = delete")
endif()
configure_file(${DICOM_CMAKE_DIR}/vtkDICOMConfig.h.in
"${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMConfig.h" @ONLY)
configure_file(${DICOM_CMAKE_DIR}/vtkDICOMBuild.h.in
......@@ -123,13 +136,26 @@ set_source_files_properties(${LIB_ABSTRACT}
set_source_files_properties(${LIB_PRIVATE_HDRS}
PROPERTIES SKIP_HEADER_INSTALL ON)
if(Module_vtkDICOM) # Building as a VTK remote module
if(DEFINED VTK_MODULE_ENABLE_VTK_DICOM)
# When building as a remote module for VTK 9 (or VTK 8.90+)
set(LIB_SRC_HDRS)
foreach(_src ${LIB_SRCS})
get_filename_component(_base ${_src} NAME_WE)
list(APPEND LIB_SRC_HDRS ${_base}.h)
endforeach()
vtk_module_add_module(VTK::DICOM
SOURCES ${LIB_SRCS}
HEADERS ${LIB_SRC_HDRS} ${LIB_HDRS})
vtk_module_link(VTK::DICOM
PRIVATE ${GDCM_LIBS} ${DCMTK_LIBS} ${SQLITE_LIBS})
elseif(Module_vtkDICOM)
# When building as a remote module for older versions of VTK
vtk_module_library(vtkDICOM ${LIB_SRCS} ${LIB_HDRS})
target_link_libraries(${LIB_NAME}
LINK_PRIVATE ${GDCM_LIBS} ${DCMTK_LIBS} ${SQLITE_LIBS})
else() # else MODULE_vtkDICOM
else()
configure_file(${DICOM_CMAKE_DIR}/vtkDICOMModule.h.in
"${CMAKE_CURRENT_BINARY_DIR}/vtkDICOMModule.h" COPYONLY)
......@@ -144,7 +170,7 @@ foreach(arg ${LIB_SRCS})
endforeach()
# Create the hierarchy file
if("${VTK_MAJOR_VERSION}" GREATER 5)
if(${VTK_VERSION} VERSION_GREATER 5)
if(BUILD_PYTHON_WRAPPERS OR BUILD_TCL_WRAPPERS OR BUILD_JAVA_WRAPPERS)
set_source_files_properties(${LIB_SPECIAL} PROPERTIES WRAP_SPECIAL ON)
set(MODULE_HIERARCHY_NAME ${LIB_NAME}Hierarchy)
......@@ -158,14 +184,14 @@ if("${VTK_MAJOR_VERSION}" GREATER 5)
endif()
# Set the library name suffix for VTK 6 libraries
set(LIB_NAME_SUFFIX "-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
set(LIB_NAME_SUFFIX "-${VTK_VERSION}")
if(DEFINED VTK_CUSTOM_LIBRARY_SUFFIX)
set(LIB_NAME_SUFFIX "${VTK_CUSTOM_LIBRARY_SUFFIX}")
endif()
# Create the library
add_library(${LIB_NAME} ${LIB_SRCS} ${LIB_HIERARCHY_STAMP})
if("${VTK_MAJOR_VERSION}" GREATER 5)
if(VTK_VERSION VERSION_GREATER 5)
set_target_properties(${LIB_NAME} PROPERTIES
OUTPUT_NAME ${LIB_NAME}${LIB_NAME_SUFFIX})
endif()
......@@ -184,7 +210,7 @@ target_link_libraries(${LIB_NAME} LINK_PRIVATE
if(BUILD_PYTHON_WRAPPERS)
set(MODULE_PYTHON_NAME ${LIB_NAME}Python)
set(${LIB_NAME}_WRAP_DEPENDS ${VTK_LIBS})
if("${VTK_MAJOR_VERSION}" GREATER 5)
if(VTK_VERSION VERSION_GREATER 5)
include(vtkWrapPython)
include_directories(${vtkPython_INCLUDE_DIRS})
set(VTK_PYTHON_LIBRARIES ${vtkPython_LIBRARIES})
......@@ -213,7 +239,7 @@ if(BUILD_PYTHON_WRAPPERS)
endif()
set(LIB_PYTHON_NAME ${LIB_NAME}PythonD)
set(LIB_PYTHON_OUTPUT_NAME ${LIB_NAME}Python${XY}D)
if("${VTK_MAJOR_VERSION}" GREATER 5)
if(VTK_VERSION VERSION_GREATER 5)
set(LIB_PYTHON_OUTPUT_NAME ${LIB_PYTHON_OUTPUT_NAME}${LIB_NAME_SUFFIX})
endif()
foreach(TMP_LIB ${VTK_LIBS})
......@@ -266,7 +292,7 @@ if(BUILD_TCL_WRAPPERS)
set(LIB_TCL_NAME ${LIB_NAME}TCL)
string(TOLOWER ${LIB_NAME} MODULE_TCL_NAME)
set(LIB_TCL_OUTPUT_NAME ${LIB_TCL_NAME})
if("${VTK_MAJOR_VERSION}" GREATER 5)
if(VTK_VERSION VERSION_GREATER 5)
set(LIB_TCL_OUTPUT_NAME ${LIB_TCL_NAME}${LIB_NAME_SUFFIX})
endif()
set(LIB_TCL_LIBS)
......
......@@ -26,6 +26,7 @@
#include "vtkThreadedImageAlgorithm.h"
#include "vtkDICOMModule.h" // For export macro
#include "vtkDICOMConfig.h" // For configuration details
class vtkLookupTable;
class vtkInformationDataObjectKey;
......@@ -44,11 +45,7 @@ public:
static vtkDICOMAlgorithm *New();
//! Print information about this object.
#ifdef VTK_OVERRIDE
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
#else
void PrintSelf(ostream& os, vtkIndent indent);
#endif
void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
//@}
//@{
......@@ -85,44 +82,26 @@ protected:
vtkInformation *outInfo, vtkDataObject *outData);
//@}
#ifdef VTK_OVERRIDE
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id) VTK_OVERRIDE;
#else
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id);
#endif
vtkImageData **outData, int ext[6], int id) VTK_DICOM_OVERRIDE;
private:
#ifdef VTK_DELETE_FUNCTION
vtkDICOMAlgorithm(const vtkDICOMAlgorithm&) VTK_DELETE_FUNCTION;
void operator=(const vtkDICOMAlgorithm&) VTK_DELETE_FUNCTION;
#elif __cplusplus >= 201103L
#ifdef VTK_DICOM_DELETE
vtkDICOMAlgorithm(const vtkDICOMAlgorithm&) VTK_DICOM_DELETE;
void operator=(const vtkDICOMAlgorithm&) VTK_DICOM_DELETE;
#else
vtkDICOMAlgorithm(const vtkDICOMAlgorithm&) = delete;
void operator=(const vtkDICOMAlgorithm&) = delete;
#else
vtkDICOMAlgorithm(const vtkDICOMAlgorithm&);
void operator=(const vtkDICOMAlgorithm&);
#endif
};
......
......@@ -43,43 +43,24 @@ public:
vtkTypeMacro(vtkDICOMApplyPalette, vtkDICOMAlgorithm);
//! Print information about this object.
#ifdef VTK_OVERRIDE
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
#else
void PrintSelf(ostream& os, vtkIndent indent);
#endif
void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
protected:
vtkDICOMApplyPalette();
~vtkDICOMApplyPalette();
#ifdef VTK_OVERRIDE
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id) VTK_OVERRIDE;
#else
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id);
#endif
vtkImageData **outData, int ext[6], int id) VTK_DICOM_OVERRIDE;
//! Container for the lookup tables used.
vtkDICOMPerFilePalette *Palette;
......@@ -88,15 +69,12 @@ protected:
bool IsSupplemental;
private:
#ifdef VTK_DELETE_FUNCTION
vtkDICOMApplyPalette(const vtkDICOMApplyPalette&) VTK_DELETE_FUNCTION;
void operator=(const vtkDICOMApplyPalette&) VTK_DELETE_FUNCTION;
#elif __cplusplus >= 201103L
#ifdef VTK_DICOM_DELETE
vtkDICOMApplyPalette(const vtkDICOMApplyPalette&) VTK_DICOM_DELETE;
void operator=(const vtkDICOMApplyPalette&) VTK_DICOM_DELETE;
#else
vtkDICOMApplyPalette(const vtkDICOMApplyPalette&) = delete;
void operator=(const vtkDICOMApplyPalette&) = delete;
#else
vtkDICOMApplyPalette(const vtkDICOMApplyPalette&);
void operator=(const vtkDICOMApplyPalette&);
#endif
};
......
......@@ -43,11 +43,7 @@ public:
static vtkDICOMApplyRescale *New();
//! Print information about this object.
#ifdef VTK_OVERRIDE
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
#else
void PrintSelf(ostream& os, vtkIndent indent);
#endif
void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
//@{
//! Set the output data type to float or double (default is double).
......@@ -64,47 +60,29 @@ protected:
vtkDICOMApplyRescale();
~vtkDICOMApplyRescale();
#ifdef VTK_OVERRIDE
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id) VTK_OVERRIDE;
#else
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id);
#endif
vtkImageData **outData, int ext[6], int id) VTK_DICOM_OVERRIDE;
vtkDICOMRealWorldMapping *Mapping;
int OutputScalarType;
private:
#ifdef VTK_DELETE_FUNCTION
vtkDICOMApplyRescale(const vtkDICOMApplyRescale&) VTK_DELETE_FUNCTION;
void operator=(const vtkDICOMApplyRescale&) VTK_DELETE_FUNCTION;
#elif __cplusplus >= 201103L
#ifdef VTK_DICOM_DELETE
vtkDICOMApplyRescale(const vtkDICOMApplyRescale&) VTK_DICOM_DELETE;
void operator=(const vtkDICOMApplyRescale&) VTK_DICOM_DELETE;
#else
vtkDICOMApplyRescale(const vtkDICOMApplyRescale&) = delete;
void operator=(const vtkDICOMApplyRescale&) = delete;
#else
vtkDICOMApplyRescale(const vtkDICOMApplyRescale&);
void operator=(const vtkDICOMApplyRescale&);
#endif
};
......
......@@ -82,6 +82,14 @@ bool vtkDICOMCTGenerator::GenerateCTImageModule(vtkDICOMMetaData *source)
meta->Set(DC::RescaleIntercept, this->RescaleIntercept);
meta->Set(DC::RescaleSlope, this->RescaleSlope);
// SpacingBetweenSlices is not part of the CT IOD, but it is a
// frequently used extended attribute. If it is present we want to
// ensure that it is correct. If absent, we don't set it.
if (meta->Has(DC::SpacingBetweenSlices))
{
meta->Set(DC::SpacingBetweenSlices, this->Spacing[2]);
}
// required items: use simple read/write validation
DC::EnumType required[] = {
DC::KVP,
......@@ -98,6 +106,7 @@ bool vtkDICOMCTGenerator::GenerateCTImageModule(vtkDICOMMetaData *source)
DC::ReconstructionDiameter,
DC::ReconstructionTargetCenterPatient,
DC::DistanceSourceToDetector,
DC::DistanceSourceToPatient,
DC::GantryDetectorTilt,
DC::TableHeight,
DC::RotationDirection,
......
......@@ -33,11 +33,7 @@ public:
vtkTypeMacro(vtkDICOMCTGenerator, vtkDICOMGenerator);
//! Print information about this object.
#ifdef VTK_OVERRIDE
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
#else
void PrintSelf(ostream& os, vtkIndent indent);
#endif
void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
//! Generate an instance of one of the supported classes.
/*!
......@@ -45,11 +41,7 @@ public:
* information for a vtkImageData object, it will populate the
* attributes of the supplied vtkDICOMMetaData object.
*/
#ifdef VTK_OVERRIDE
bool GenerateInstance(vtkInformation *info) VTK_OVERRIDE;
#else
bool GenerateInstance(vtkInformation *info);
#endif
bool GenerateInstance(vtkInformation *info) VTK_DICOM_OVERRIDE;
protected:
vtkDICOMCTGenerator();
......@@ -65,15 +57,12 @@ protected:
virtual bool GenerateCTInstance(vtkInformation *info);
private:
#ifdef VTK_DELETE_FUNCTION
vtkDICOMCTGenerator(const vtkDICOMCTGenerator&) VTK_DELETE_FUNCTION;
void operator=(const vtkDICOMCTGenerator&) VTK_DELETE_FUNCTION;
#elif __cplusplus >= 201103L
#ifdef VTK_DICOM_DELETE
vtkDICOMCTGenerator(const vtkDICOMCTGenerator&) VTK_DICOM_DELETE;
void operator=(const vtkDICOMCTGenerator&) VTK_DICOM_DELETE;
#else
vtkDICOMCTGenerator(const vtkDICOMCTGenerator&) = delete;
void operator=(const vtkDICOMCTGenerator&) = delete;
#else
vtkDICOMCTGenerator(const vtkDICOMCTGenerator&);
void operator=(const vtkDICOMCTGenerator&);
#endif
};
......
......@@ -37,11 +37,7 @@ public:
vtkTypeMacro(vtkDICOMCTRectifier, vtkDICOMAlgorithm);
//! Print information about this object.
#ifdef VTK_OVERRIDE
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
#else
void PrintSelf(ostream& os, vtkIndent indent);
#endif
void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
//@{
//! Interpolation constants.
......@@ -136,41 +132,22 @@ protected:
const double matrix[16], const int extent[6], double spacing[3],
double origin[3]);
#ifdef VTK_OVERRIDE
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
int RequestUpdateExtent(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) VTK_OVERRIDE;
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id) VTK_OVERRIDE;
#else
int RequestInformation(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
int RequestUpdateExtent(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
int RequestData(
vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
void ThreadedRequestData(
vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector, vtkImageData ***inData,
vtkImageData **outData, int ext[6], int id);
#endif
vtkImageData **outData, int ext[6], int id) VTK_DICOM_OVERRIDE;
vtkMatrix4x4 *VolumeMatrix;
vtkMatrix4x4 *RectifiedMatrix;
......@@ -179,15 +156,12 @@ protected:
int InterpolationMode;
private:
#ifdef VTK_DELETE_FUNCTION
vtkDICOMCTRectifier(const vtkDICOMCTRectifier&) VTK_DELETE_FUNCTION;
void operator=(const vtkDICOMCTRectifier&) VTK_DELETE_FUNCTION;
#elif __cplusplus >= 201103L
#ifdef VTK_DICOM_DELETE
vtkDICOMCTRectifier(const vtkDICOMCTRectifier&) VTK_DICOM_DELETE;
void operator=(const vtkDICOMCTRectifier&) VTK_DICOM_DELETE;
#else
vtkDICOMCTRectifier(const vtkDICOMCTRectifier&) = delete;
void operator=(const vtkDICOMCTRectifier&) = delete;
#else
vtkDICOMCTRectifier(const vtkDICOMCTRectifier&);
void operator=(const vtkDICOMCTRectifier&);
#endif
};
......