Skip to content
Commits on Source (2)
......@@ -5,15 +5,16 @@
##-----------------------------------------------------------------------------
project (plastimatch)
## The version here should be equal to the "most recent release"
# The version here should be equal to the "most recent release"
set (PLM_VERSION_MAJOR "1")
set (PLM_VERSION_MINOR "7")
set (PLM_VERSION_PATCH "4")
set (PLM_VERSION_MINOR "8")
set (PLM_VERSION_PATCH "0")
##-----------------------------------------------------------------------------
## Set up CMake defaults
##-----------------------------------------------------------------------------
cmake_minimum_required (VERSION 2.8.12)
# CMAKE_CXX_STANDARD was introduced in 3.1.3
cmake_minimum_required (VERSION 3.1.3)
# CMP0003: Libraries linked via full path no longer produce linker search
# paths.
......@@ -35,9 +36,13 @@ endif ()
if (POLICY CMP0054)
cmake_policy (SET CMP0054 NEW)
endif ()
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
##-----------------------------------------------------------------------------
## CMake include files
## CMake path
##-----------------------------------------------------------------------------
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
......@@ -47,11 +52,17 @@ set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include (PreventInSourceBuilds)
##-----------------------------------------------------------------------------
## Macros and functions used in this script
## Misc macros and functions used in this script
##-----------------------------------------------------------------------------
include (PlmMacros)
include (SuperbuildOptions)
##-----------------------------------------------------------------------------
## Set C++ compiler standard
##-----------------------------------------------------------------------------
sb_set(CMAKE_CXX_STANDARD 11)
sb_set(CMAKE_CXX_STANDARD_REQUIRED ON)
##-----------------------------------------------------------------------------
## Define default build type as Release
##-----------------------------------------------------------------------------
......@@ -96,6 +107,8 @@ sb_option (PLM_CONFIG_PREFER_PATCHED_ITK
"Prefer to use the patched version of certain ITK files" ON)
sb_option (PLM_CONFIG_VOL_LIST
"Native support for volumes with irregular slice thicknesses" OFF)
sb_option (PLM_CONFIG_HARDEN_XFORM_BY_DEFAULT
"By default, harden linear transforms rather than resample" OFF)
# Plastimatch legacy options
sb_option (PLM_CONFIG_LEGACY_BSPLINE_EXTEND
......@@ -239,6 +252,13 @@ if (WIN32 AND NOT CYGWIN AND NOT MINGW)
)
endif ()
##-----------------------------------------------------------------------------
## Disable spurious warnings on GCC
##-----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCC)
add_compile_options (-Wno-cpp)
endif ()
##-----------------------------------------------------------------------------
## Compile with -fPIC is needed for amd64 and other platforms
##-----------------------------------------------------------------------------
......@@ -247,10 +267,10 @@ plm_set_pic_flags ()
##-----------------------------------------------------------------------------
## Extra paths
##-----------------------------------------------------------------------------
set (PLM_TESTING_SOURCE_DIR "${CMAKE_SOURCE_DIR}/Testing")
set (PLM_TESTING_DATA_DIR "${CMAKE_SOURCE_DIR}/Testing/Data")
set (PLM_TESTING_DOWNLOAD_DATA_DIR "${CMAKE_BINARY_DIR}/TestData")
set (PLM_BUILD_TESTING_DIR "${CMAKE_BINARY_DIR}/Testing")
set (PLM_TESTING_SOURCE_DIR "${PLM_SOURCE_DIR}/Testing")
set (PLM_TESTING_DATA_DIR "${PLM_SOURCE_DIR}/Testing/Data")
set (PLM_TESTING_DOWNLOAD_DATA_DIR "${PLM_BINARY_DIR}/TestData")
set (PLM_BUILD_TESTING_DIR "${PLM_BINARY_DIR}/Testing")
##-----------------------------------------------------------------------------
## Set the math library
......@@ -342,7 +362,7 @@ find_package (wxWidgets)
##-----------------------------------------------------------------------------
if (NOT LIBLBFGS_FOUND)
add_subdirectory (libs/liblbfgs-1.9)
sb_set (LIBLBFGS_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/liblbfgs-1.9/include")
sb_set (LIBLBFGS_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs/liblbfgs-1.9/include")
sb_set (LIBLBFGS_LIBRARIES lbfgs)
link_directories (${CMAKE_CURRENT_BINARY_DIR}/libs/liblbfgs-1.9)
sb_set (LIBLBFGS_FOUND TRUE)
......@@ -353,7 +373,7 @@ endif ()
##-----------------------------------------------------------------------------
if (NOT SQLITE_FOUND AND NOT PLM_CONFIG_DEBIAN_BUILD)
add_subdirectory (libs/sqlite-3.6.21)
set (SQLITE_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/sqlite-3.6.21")
set (SQLITE_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs/sqlite-3.6.21")
set (SQLITE_LIBRARIES sqlite3)
set (SQLITE_FOUND TRUE)
endif ()
......@@ -361,13 +381,13 @@ endif ()
#-----------------------------------------------------------------------------
## Only use local devillard
##-----------------------------------------------------------------------------
sb_set (DEVILLARD_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/devillard")
sb_set (DEVILLARD_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs/devillard")
add_subdirectory (libs/devillard)
##-----------------------------------------------------------------------------
## Only use local inih
##-----------------------------------------------------------------------------
sb_set (INIH_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/inih-r29")
sb_set (INIH_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs/inih-r29")
add_subdirectory (libs/inih-r29)
##-----------------------------------------------------------------------------
......@@ -375,7 +395,7 @@ add_subdirectory (libs/inih-r29)
##-----------------------------------------------------------------------------
# We can't use debian's lua 5.1 because it doesn't contain lobject.h
#add_subdirectory (libs/lua-5.1.4)
#set (LUA_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/lua-5.1.4/src")
#set (LUA_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs/lua-5.1.4/src")
#link_directories (${CMAKE_CURRENT_BINARY_DIR}/libs/lua-5.1.4)
# for history, etc in plastimatch tty mode
......@@ -392,12 +412,12 @@ sb_set (SPECFUN_FOUND TRUE)
##-----------------------------------------------------------------------------
## Only use local msinttypes
##-----------------------------------------------------------------------------
sb_set (MSINTTYPES_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs")
sb_set (MSINTTYPES_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs")
##-----------------------------------------------------------------------------
## Only use local nkidecompress
##-----------------------------------------------------------------------------
sb_set (NKIDECOMPRESS_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/nkidecompress")
sb_set (NKIDECOMPRESS_INCLUDE_DIR "${PLM_SOURCE_DIR}/libs/nkidecompress")
add_subdirectory (libs/nkidecompress)
##-----------------------------------------------------------------------------
......@@ -513,7 +533,7 @@ set (PLM_BASIC_VERSION_STRING
"${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH}")
set (PLASTIMATCH_VERSION_STRING
"${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH}")
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
if (EXISTS "${PLM_SOURCE_DIR}/.git" AND GIT_FOUND)
if (GIT_EXECUTABLE MATCHES "[wW][sS][lL].*")
set (GIT_EXECUTABLE "wsl;git")
endif ()
......@@ -521,7 +541,7 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
COMMAND
#${GIT_EXECUTABLE} rev-list --first-parent --count HEAD
${GIT_EXECUTABLE} ${GIT_EXECUTABLE_EXTRA} describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
WORKING_DIRECTORY "${PLM_SOURCE_DIR}"
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_output
ERROR_VARIABLE git_error
......@@ -606,7 +626,7 @@ endif ()
##-----------------------------------------------------------------------------
## Only use local rapidjson
##-----------------------------------------------------------------------------
set (RAPIDJSON_DIR "${CMAKE_SOURCE_DIR}/libs/rapidjson-2015-03-22")
set (RAPIDJSON_DIR "${PLM_SOURCE_DIR}/libs/rapidjson-2015-03-22")
if (EXISTS "${RAPIDJSON_DIR}" AND IS_DIRECTORY "${RAPIDJSON_DIR}")
set (RAPIDJSON_INCLUDE_DIR
"${RAPIDJSON_DIR}/include"
......@@ -694,7 +714,7 @@ endif ()
# Add sample directory/files to Install Only for windows users
if (WIN32 OR WIN64)
set (PLM_WINDOWS_INSTALL_DIR "${CMAKE_SOURCE_DIR}/extra/windows-install")
set (PLM_WINDOWS_INSTALL_DIR "${PLM_SOURCE_DIR}/extra/windows-install")
install (DIRECTORY "${PLM_WINDOWS_INSTALL_DIR}/sample" DESTINATION bin)
install (FILES "${PLM_WINDOWS_INSTALL_DIR}/launch_cmd_prompt.bat" DESTINATION bin)
endif ()
......@@ -796,9 +816,9 @@ macro (PLM_ADD_TEST PLM_TEST_NAME PLM_TEST_COMMAND PARMS)
-DPLM_BUILD_TESTING_DIR=${PLM_BUILD_TESTING_DIR}
"-DPARMS=${TMP_PARMS}"
${EXTRA_PARMS}
-P ${CMAKE_SOURCE_DIR}/cmake/RUN_CTEST.cmake
-P ${PLM_SOURCE_DIR}/cmake/RUN_CTEST.cmake
)
# message (STATUS "${CMAKE_COMMAND} -DPLM_TEST_NAME=${PLM_TEST_NAME} ${PLM_ITK_LIBRARY_PATH_HACK} ${PLM_PLASTIMATCH_PATH_HACK} ${PLM_FFTW_PATH_HACK} -DPLM_TEST_COMMAND=${PLM_TEST_COMMAND} -DPLM_TESTING_SOURCE_DIR=${PLM_TESTING_SOURCE_DIR} -DPLM_BUILD_TESTING_DIR=${PLM_BUILD_TESTING_DIR} \"-DPARMS=${TMP_PARMS}\" ${EXTRA_PARMS} -P ${CMAKE_SOURCE_DIR}/cmake/RUN_CTEST.cmake")
# message (STATUS "${CMAKE_COMMAND} -DPLM_TEST_NAME=${PLM_TEST_NAME} ${PLM_ITK_LIBRARY_PATH_HACK} ${PLM_PLASTIMATCH_PATH_HACK} ${PLM_FFTW_PATH_HACK} -DPLM_TEST_COMMAND=${PLM_TEST_COMMAND} -DPLM_TESTING_SOURCE_DIR=${PLM_TESTING_SOURCE_DIR} -DPLM_BUILD_TESTING_DIR=${PLM_BUILD_TESTING_DIR} \"-DPARMS=${TMP_PARMS}\" ${EXTRA_PARMS} -P ${PLM_SOURCE_DIR}/cmake/RUN_CTEST.cmake")
endmacro ()
# Figure out which tests to ignore
......@@ -806,11 +826,11 @@ endmacro ()
# in either directory. MSVC uses the one in ${CMAKE_BINARY_DIR}.
configure_file (
${PLM_TESTING_SOURCE_DIR}/CTestCustom.cmake.in
${CMAKE_BINARY_DIR}/CTestCustom.cmake
${PLM_BINARY_DIR}/CTestCustom.cmake
@ONLY)
configure_file (
${PLM_TESTING_SOURCE_DIR}/CTestCustom.cmake.in
${CMAKE_BINARY_DIR}/Testing/CTestCustom.cmake
${PLM_BINARY_DIR}/Testing/CTestCustom.cmake
@ONLY)
if (PLM_BUILD_TESTING)
......@@ -818,10 +838,10 @@ if (PLM_BUILD_TESTING)
add_subdirectory (Testing)
# Copy the lconv script
if (EXISTS "${CMAKE_SOURCE_DIR}/extra/devtools/run_lcov.sh")
if (EXISTS "${PLM_SOURCE_DIR}/extra/devtools/run_lcov.sh")
configure_file (
"${CMAKE_SOURCE_DIR}/extra/devtools/run_lcov.sh"
"${CMAKE_BINARY_DIR}/run_lcov.sh"
"${PLM_SOURCE_DIR}/extra/devtools/run_lcov.sh"
"${PLM_BINARY_DIR}/run_lcov.sh"
COPYONLY)
endif ()
endif ()
......
This diff is collapsed.
#Insight Transform File V1.0
#Transform 0
Transform: AffineTransform_double_3_3
Parameters: 0.925416578398323 0.1631759111665347 0.3420201433256686 0.018028311236297216 0.8825641192593854 -0.46984631039295405 -0.3785223063697923 0.4409696105298823 0.8137976813493736 2.257079707543866 31.926954809339303 -19.37976129358149
FixedParameters: 0 0 0
......@@ -8,16 +8,10 @@ if (DCMTK_wrap_FIND_REQUIRED)
list (APPEND DCMTK_EXTRA_ARGS REQUIRED)
endif ()
# if (DCMTK_DIR AND EXISTS "${DCMTK_DIR}/DCMTKConfig.cmake")
# find_package (DCMTK NO_MODULE ${EXTRA_ARGS})
# else ()
# find_package (DCMTK_legacy ${EXTRA_ARGS})
# endif ()
find_package (DCMTK NO_MODULE ${EXTRA_ARGS})
find_package (DCMTK NO_MODULE ${DCMTK_EXTRA_ARGS})
if (NOT DCMTK_FOUND)
message (STATUS "Searching for DCMTK using legacy method")
find_package (DCMTK_legacy ${EXTRA_ARGS})
find_package (DCMTK_legacy ${DCMTK_EXTRA_ARGS})
endif ()
# The DCMTK 3.6.2 DCMTKConfig.cmake seems to be broken on windows
......
......@@ -40,8 +40,8 @@ elseif (${ITK_VERSION_MAJOR} VERSION_EQUAL "4")
"Fatal Error. ITK 4 must be 4.1 or greater")
endif ()
else ()
message (FATAL_ERROR
"Fatal Error. ITK version should be either 3.X or 4.X")
message (AUTHOR_WARNING
"Warning. ITK version greater than 4.X is not tested")
endif ()
message (STATUS "ITK_VERSION = ${ITK_VERSION} found")
......
......@@ -13,7 +13,7 @@ file is included in the distribution.
Conformance
-----------
Plastimatch 1.X series must conform to the C++03 standard.
Plastimatch <= 1.7 series must conform to the C++03 standard.
Supported hosts:
Microsoft Windows 7 SP1 Visual Studio 2015 (for CUDA 8)
......@@ -23,7 +23,7 @@ Supported hosts:
Arch linux (varies)
OSX 10.11 El Capitan Xcode 8.2.1; clang-800; llvm 3.9.0svn
Plastimatch 2.X series (planned) must conform to a restricted
Plastimatch >= 1.8 series must conform to a restricted
subset of the C++11 standard. This subset is restricted to
features available in the stock compilers provided on
a fully-updated install of the supported platforms.
......
.\" Man page generated from reStructuredText.
.
.TH "DRR" "1" "Jan 08, 2019" "Plastimatch 1.7.4" "Plastimatch"
.TH "DRR" "1" "Apr 30, 2019" "Plastimatch 1.8.0" "Plastimatch"
.SH NAME
drr \- create a digitally reconstructed radiograph
.
......@@ -178,6 +178,6 @@ as follows:
.SH AUTHOR
Plastimatch is a collaborative project. For additional documentation, please visit http://plastimatch.org. For questions, comments, and bug reports, please visit http://groups.google.com/group/plastimatch.
.SH COPYRIGHT
Plastimatch development team (C) 2010-2015. You are free to use, modify, and distribute plastimatch according to a BSD-style license. Please see LICENSE.TXT for details.
Plastimatch development team (C) 2010-2019. You are free to use, modify, and distribute plastimatch according to a BSD-style license. Please see LICENSE.TXT for details.
.\" Generated by docutils manpage writer.
.
.\" Man page generated from reStructuredText.
.
.TH "FDK" "1" "Jan 08, 2019" "Plastimatch 1.7.4" "Plastimatch"
.TH "FDK" "1" "Apr 30, 2019" "Plastimatch 1.8.0" "Plastimatch"
.SH NAME
fdk \- cone-beam reconstruction from projections using the FDK algorithm
.
......@@ -148,6 +148,6 @@ Geometry of Varian HND files.UNINDENT
.SH AUTHOR
Plastimatch is a collaborative project. For additional documentation, please visit http://plastimatch.org. For questions, comments, and bug reports, please visit http://groups.google.com/group/plastimatch.
.SH COPYRIGHT
Plastimatch development team (C) 2010-2015. You are free to use, modify, and distribute plastimatch according to a BSD-style license. Please see LICENSE.TXT for details.
Plastimatch development team (C) 2010-2019. You are free to use, modify, and distribute plastimatch according to a BSD-style license. Please see LICENSE.TXT for details.
.\" Generated by docutils manpage writer.
.
.\" Man page generated from reStructuredText.
.
.TH "LANDMARK_WARP" "1" "Jan 08, 2019" "Plastimatch 1.7.4" "Plastimatch"
.TH "LANDMARK_WARP" "1" "Apr 30, 2019" "Plastimatch 1.8.0" "Plastimatch"
.SH NAME
landmark_warp \- warp an image using point landmarks
.
......@@ -123,6 +123,6 @@ Regularization of vector field is available for "gauss" and "wendland" algorith
.SH AUTHOR
Plastimatch is a collaborative project. For additional documentation, please visit http://plastimatch.org. For questions, comments, and bug reports, please visit http://groups.google.com/group/plastimatch.
.SH COPYRIGHT
Plastimatch development team (C) 2010-2015. You are free to use, modify, and distribute plastimatch according to a BSD-style license. Please see LICENSE.TXT for details.
Plastimatch development team (C) 2010-2019. You are free to use, modify, and distribute plastimatch according to a BSD-style license. Please see LICENSE.TXT for details.
.\" Generated by docutils manpage writer.
.
This diff is collapsed.
......@@ -12,6 +12,9 @@
#include "itkVectorNeighborhoodOperatorImageFilter.h"
#include "vnl/vnl_math.h"
#if ITK_VERSION_MAJOR >= 5
#include "vcl_legacy_aliases.h"
#endif
namespace itk
{
......
......@@ -338,7 +338,11 @@ private:
mutable double m_SumOfSquaredChange;
/** Mutex lock to protect modification to metric. */
#if (ITK_VERSION_MAJOR >= 5)
mutable std::mutex m_MetricCalculationLock;
#else
mutable SimpleFastMutexLock m_MetricCalculationLock;
#endif
MaskPointer m_MovingMask;
MaskPointer m_FixedMask;
};
......
......@@ -21,6 +21,9 @@
#include "itkESMDemonsRegistrationWithMaskFunction.h"
#include "itkExceptionObject.h"
#include "vnl/vnl_math.h"
#if ITK_VERSION_MAJOR >= 5
#include "vcl_legacy_aliases.h"
#endif
#include "itkImageMaskSpatialObject.h"
namespace itk
......@@ -546,7 +549,11 @@ ESMDemonsRegistrationWithMaskFunction<TFixedImage, TMovingImage,
{
GlobalDataStruct *globalData = (GlobalDataStruct *)gd;
#if (ITK_VERSION_MAJOR >= 5)
m_MetricCalculationLock.lock();
#else
m_MetricCalculationLock.Lock();
#endif
m_SumOfSquaredDifference += globalData->m_SumOfSquaredDifference;
m_NumberOfPixelsProcessed += globalData->m_NumberOfPixelsProcessed;
m_SumOfSquaredChange += globalData->m_SumOfSquaredChange;
......@@ -557,7 +564,11 @@ ESMDemonsRegistrationWithMaskFunction<TFixedImage, TMovingImage,
m_RMSChange = vcl_sqrt( m_SumOfSquaredChange
/ static_cast<double>( m_NumberOfPixelsProcessed ) );
}
#if (ITK_VERSION_MAJOR >= 5)
m_MetricCalculationLock.unlock();
#else
m_MetricCalculationLock.Unlock();
#endif
delete globalData;
}
......
......@@ -28,6 +28,9 @@
#include "itkVectorNeighborhoodOperatorImageFilter.h"
#include "vnl/vnl_math.h"
#if ITK_VERSION_MAJOR >= 5
#include "vcl_legacy_aliases.h"
#endif
namespace itk {
......
......@@ -8,8 +8,13 @@
#include <time.h>
#include <limits>
#include "ParametersEstimator.h"
#if ITK_VERSION_MAJOR >= 5
#include <mutex>
#include "itkPlatformMultiThreader.h"
#else
#include "itkMultiThreader.h"
#include "itkSimpleFastMutexLock.h"
#endif
#include "itkExceptionObject.h"
/**
......@@ -168,8 +173,13 @@ private:
std::vector<S> best_estimate;
typename ParametersEstimator<T,S>::Pointer paramEstimator;
#if ITK_VERSION_MAJOR >= 5
std::mutex hypothesisMutex;
std::mutex resultsMutex;
#else
itk::SimpleFastMutexLock hypothesisMutex;
itk::SimpleFastMutexLock resultsMutex;
#endif
};
} // end namespace itk
......
......@@ -21,11 +21,17 @@ RANSAC<T,S>::~RANSAC( )
template<class T, class S>
void RANSAC<T,S>::SetNumberOfThreads( unsigned int numberOfThreads )
{
#if ITK_VERSION_MAJOR >= 5
if( numberOfThreads==0 ||
numberOfThreads>itk::PlatformMultiThreader::GetGlobalDefaultNumberOfThreads() )
throw ExceptionObject(__FILE__,__LINE__,
"Invalid setting for number of threads.");
#else
if( numberOfThreads==0 ||
numberOfThreads>itk::MultiThreader::GetGlobalDefaultNumberOfThreads() )
throw ExceptionObject(__FILE__,__LINE__,
"Invalid setting for number of threads.");
#endif
this->numberOfThreads = numberOfThreads;
}
......@@ -100,7 +106,11 @@ double RANSAC<T,S>::Compute( std::vector<S> &parameters,
//STEP2: create the threads that generate hypotheses and test
#if ITK_VERSION_MAJOR >= 5
itk::PlatformMultiThreader::Pointer threader = itk::PlatformMultiThreader::New();
#else
itk::MultiThreader::Pointer threader = itk::MultiThreader::New();
#endif
threader->SetNumberOfThreads( this->numberOfThreads );
threader->SetSingleMethod( RANSAC<T,S>::RANSACThreadCallback, this );
//runs all threads and blocks till they finish
......@@ -139,9 +149,18 @@ double RANSAC<T,S>::Compute( std::vector<S> &parameters,
template<class T, class S>
ITK_THREAD_RETURN_TYPE RANSAC<T,S>::RANSACThreadCallback( void *arg )
#if ITK_VERSION_MAJOR >= 5
itk::ITK_THREAD_RETURN_TYPE
#else
ITK_THREAD_RETURN_TYPE
#endif
RANSAC<T,S>::RANSACThreadCallback( void *arg )
{
#if ITK_VERSION_MAJOR >= 5
typedef itk::PlatformMultiThreader::ThreadInfoStruct ThreadInfoType;
#else
typedef itk::MultiThreader::ThreadInfoStruct ThreadInfoType;
#endif
ThreadInfoType *infoStruct = static_cast<ThreadInfoType*>( arg );
//dynamic_cast doesn't work with void *
RANSAC<T,S> *caller =
......@@ -191,13 +210,20 @@ ITK_THREAD_RETURN_TYPE RANSAC<T,S>::RANSACThreadCallback( void *arg )
l++;
}
}
#if ITK_VERSION_MAJOR >= 5
caller->hypothesisMutex.lock();
#else
caller->hypothesisMutex.Lock();
#endif
//check that the sub-set just chosen is unique
std::pair< typename std::set<int *, SubSetIndexComparator >::iterator, bool> res = caller->chosenSubSets->insert( curSubSetIndexes );
#if ITK_VERSION_MAJOR >= 5
caller->hypothesisMutex.unlock();
#else
caller->hypothesisMutex.Unlock();
#endif
if(res.second == true) { //first time we chose this sub set
//use the selected data for an exact model parameter fit
......@@ -220,7 +246,11 @@ ITK_THREAD_RETURN_TYPE RANSAC<T,S>::RANSACThreadCallback( void *arg )
}
// Did we find a larger consensus set?
#if ITK_VERSION_MAJOR >= 5
caller->resultsMutex.lock();
#else
caller->resultsMutex.Lock();
#endif
if( numVotesForCur > caller->numVotesForBest ) {
caller->numVotesForBest = numVotesForCur;
std::copy( curVotes, curVotes+numDataObjects, caller->bestVotes );
......@@ -238,7 +268,11 @@ ITK_THREAD_RETURN_TYPE RANSAC<T,S>::RANSACThreadCallback( void *arg )
caller->numTries = caller->numTries<caller->allTries ? caller->numTries : caller->allTries;
}
}
#if ITK_VERSION_MAJOR >= 5
caller->resultsMutex.unlock();
#else
caller->resultsMutex.Unlock();
#endif
}
else { //this sub set already appeared, release memory
delete [] curSubSetIndexes;
......@@ -247,7 +281,11 @@ ITK_THREAD_RETURN_TYPE RANSAC<T,S>::RANSACThreadCallback( void *arg )
delete [] curVotes;
delete [] notChosen;
}
#if ITK_VERSION_MAJOR >= 5
return itk::ITK_THREAD_RETURN_DEFAULT_VALUE;
#else
return ITK_THREAD_RETURN_VALUE;
#endif
}
/*****************************************************************************/
......
Version 1.7.4 (tag v1.7.4)
Version 1.8.0 (tag 1.8.0)
Tue Apr 30 09:18:59 EDT 2019
* FDK, DRR and landmark-warp functionality is now included in the
plastimatch program and no provided as a separate program
* Change to C++11 as official standard
* ITK 5 now supported
* Many new options in the adjust command: linear, local linear, and histogram
matching are now supported
* Registration and xf-convert can harden linear transforms instead of resampling
* The xf-invert command can now use DICOM with the --fixed option
Version 1.7.4 (tag 1.7.4)
Tue Jan 8 12:28:02 EST 2019
* Implement xf-invert for inverting linear transforms
* Deformable DICOM SRO export
......
......@@ -202,7 +202,7 @@ endif ()
##-----------------------------------------------------------------------------
set (INCLUDE_THESE_TWICE false)
include_directories (BEFORE ${CMAKE_BINARY_DIR})
include_directories (BEFORE ${PLM_BINARY_DIR})
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/base)
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/cli)
......@@ -288,9 +288,9 @@ endif ()
## CONFIGURE INCLUDE FILES
##-----------------------------------------------------------------------------
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sys/plm_config.h.in
${CMAKE_BINARY_DIR}/plm_config.h)
${PLM_BINARY_DIR}/plm_config.h)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sys/plm_version.h.in
${CMAKE_BINARY_DIR}/plm_version.h)
${PLM_BINARY_DIR}/plm_version.h)
##-----------------------------------------------------------------------------
## Option to generate .clang_complete for hip Vim users using clang_complete
......@@ -363,7 +363,7 @@ if (NOT PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
$<INSTALL_INTERFACE:${PLM_INSTALL_INCLUDE_DIR}>
)
list (APPEND PLASTIMATCH_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${PLM_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/plastimatch/sys>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/plastimatch/base>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/plastimatch/util>
......@@ -470,7 +470,7 @@ if (PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
export (TARGETS
${EXPORT_TARGET_LIST}
FILE "${CMAKE_BINARY_DIR}/PlastimatchLibraryDepends.cmake")
FILE "${PLM_BINARY_DIR}/PlastimatchLibraryDepends.cmake")
# Help cmake find the PlastimatchConfig.cmake in the build directory
if (NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8)
......@@ -482,15 +482,15 @@ if (PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
"${PLM_INSTALL_INCLUDE_DIR}")
configure_file (
"${PROJECT_SOURCE_DIR}/cmake/PlastimatchConfig-Legacy.cmake.in"
"${CMAKE_BINARY_DIR}/PlastimatchConfig.cmake"
"${PLM_BINARY_DIR}/PlastimatchConfig.cmake"
@ONLY)
configure_file (
"${PROJECT_SOURCE_DIR}/cmake/PlastimatchBuildTreeSettings.cmake.in"
"${CMAKE_BINARY_DIR}/PlastimatchBuildTreeSettings.cmake" @ONLY)
"${PLM_BINARY_DIR}/PlastimatchBuildTreeSettings.cmake" @ONLY)
# Install the PlastimatchConfig.cmake file
install (FILES
"${CMAKE_BINARY_DIR}/PlastimatchConfig.cmake"
"${PLM_BINARY_DIR}/PlastimatchConfig.cmake"
DESTINATION "${PLM_INSTALL_CMAKE_DIR}"
# COMPONENT dev
)
......@@ -516,14 +516,14 @@ else (PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
# Make the targets file
if (NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.0)
export (EXPORT PlastimatchLibraryDepends
FILE "${CMAKE_BINARY_DIR}/PlastimatchLibraryDepends.cmake"
FILE "${PLM_BINARY_DIR}/PlastimatchLibraryDepends.cmake"
)
endif ()
# Make the config file
configure_file (
"${PROJECT_SOURCE_DIR}/cmake/PlastimatchConfig.cmake.in"
"${CMAKE_BINARY_DIR}/PlastimatchConfig.cmake"
"${PLM_BINARY_DIR}/PlastimatchConfig.cmake"
@ONLY)
# Install the files
......@@ -531,7 +531,7 @@ else (PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
DESTINATION "${PLM_INSTALL_CMAKE_DIR}"
)
install (FILES
"${CMAKE_BINARY_DIR}/PlastimatchConfig.cmake"
"${PLM_BINARY_DIR}/PlastimatchConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/PlastimatchConfigVersion.cmake"
DESTINATION "${PLM_INSTALL_CMAKE_DIR}"
COMPONENT Devel
......@@ -543,14 +543,14 @@ endif (PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
## DOXYGEN
##-----------------------------------------------------------------------------
if (DOXYGEN_FOUND)
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/doc")
file (MAKE_DIRECTORY "${PLM_BINARY_DIR}/doc")
configure_file (
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
@ONLY)
add_custom_target (doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc"
WORKING_DIRECTORY "${PLM_BINARY_DIR}/doc"
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif ()
......@@ -5,7 +5,7 @@ project (src_plastimatch_base)
configure_file (
${CMAKE_CURRENT_SOURCE_DIR}/plmbase_config.h.in
${CMAKE_BINARY_DIR}/plmbase_config.h
${PLM_BINARY_DIR}/plmbase_config.h
)
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
......@@ -62,7 +62,7 @@ set (PLMBASE_LIBRARY_SRC
itk_image_origin.cxx itk_image_origin.h
itk_image_region.cxx itk_image_region.h
itk_image_save.cxx itk_image_save.h
itk_image_scale.cxx itk_image_scale.h
itk_image_shift_scale.cxx itk_image_shift_scale.h
itk_image_stats.cxx itk_image_stats.h
itk_image_type.h
itk_metadata.cxx itk_metadata.h
......@@ -189,7 +189,7 @@ else ()
endif ()
set (PLMBASE_LIBRARY_HEADERS
"${CMAKE_BINARY_DIR}/plmbase_config.h"
"${PLM_BINARY_DIR}/plmbase_config.h"
)
foreach (ARG ${PLMBASE_LIBRARY_SRC})
string (REGEX MATCH ".*\\.h$" TMP "${ARG}")
......
......@@ -69,6 +69,7 @@ Dcmtk_rt_study::image_load ()
continue;
}
/* Else insert new element into group_list */
//printf ("Match not found. :(\n");
group_list.push_back (Dcmtk_file_list());
group_list.back().push_back (df);
}
......@@ -209,15 +210,15 @@ Dcmtk_rt_study::image_load ()
into a PLM_IMG_TYPE_GPUIT_LIST */
#if (PLM_CONFIG_VOL_LIST)
/* Get first slice of group */
/* Get first slice of first chunk */
Dcmtk_file_list::iterator it = flist->begin();
df = it->get();
/* Get next slice in group */
float z_init, z_prev, z_diff, z_last;
int slice_no = 0;
float best_chunk_z_start = z_init = z_prev = df->get_z_position ();
/* Get second slice to form first chunk */
++it; ++slice_no;
df = (*it).get();
z_diff = df->get_z_position() - z_prev;
......@@ -234,7 +235,6 @@ Dcmtk_rt_study::image_load ()
while (++it != flist->end())
{
++slice_no;
printf ("Slice no: %d\n", slice_no);
df = (*it).get();
z_diff = df->get_z_position() - z_prev;
z_last = z_prev = df->get_z_position();
......@@ -275,21 +275,23 @@ Dcmtk_rt_study::image_load ()
#endif
#else /* NOT VOL_LIST */
/* Get next slice in first chunk */
/* We want to find the largest chunk (most slices) with equal spacing.
This will be used to resample in the case of irregular spacing. */
/* Get first slice of first chunk */
float z_init, z_prev, z_diff, z_last;
int slice_no = 0;
float best_chunk_z_start = z_init = z_prev = df->get_z_position ();
const Dcmtk_file* df_this_chunk_start = df;
const Dcmtk_file* df_best_chunk_start = df;
/* Get second slice to form first chunk */
std::list<Dcmtk_file::Pointer>::const_iterator it = flist->begin();
++it; ++slice_no;
df = (*it).get();
z_diff = df->get_z_position() - z_prev;
z_last = z_prev = df->get_z_position();
/* We want to find the largest chunk with equal spacing. This will
be used to resample in the case of irregular spacing. */
int this_chunk_start = 0, best_chunk_start = 0;
float this_chunk_diff = z_diff, best_chunk_diff = z_diff;
size_t this_chunk_len = 2, best_chunk_len = 2;
......@@ -301,6 +303,7 @@ Dcmtk_rt_study::image_load ()
df = (*it).get();
z_diff = df->get_z_position() - z_prev;
z_last = z_prev = df->get_z_position();
// lprintf ("Slice %d, z_pos %f\n", slice_no, df->get_z_position());
if (fabs (this_chunk_diff - z_diff) > 0.11) {
/* Start a new chunk if difference in thickness is
......@@ -308,7 +311,7 @@ Dcmtk_rt_study::image_load ()
this_chunk_start = slice_no - 1;
this_chunk_len = 2;
this_chunk_diff = z_diff;
df_best_chunk_start = it->get();
df_this_chunk_start = std::prev(it)->get();
} else {
/* Same thickness, increase size of this chunk */
this_chunk_diff = ((this_chunk_len * this_chunk_diff) + z_diff)
......@@ -351,22 +354,27 @@ Dcmtk_rt_study::image_load ()
/* Create a Volume_header to hold the final, resampled, image geometry */
Volume_header vh (df_best_chunk_start->get_volume_header());
printf ("--- *2 ----\n");
vh.print();
// vh.print();
const float *dc = vh.get_direction_cosines();
plm_long *dim = vh.get_dim();
float *spacing = vh.get_spacing();
float *origin = vh.get_origin();
int slices_before =
ROUND_INT ((best_chunk_z_start - z_init) / best_chunk_diff);
// printf ("bczs: %f, zi: %f, bcd: %f\n", best_chunk_z_start, z_init, best_chunk_diff);
// printf ("slices_before: %d\n", slices_before);
int slices_after =
ROUND_INT ((z_last - best_chunk_z_start
- (best_chunk_len - 1) * best_chunk_diff) / best_chunk_diff);
// printf ("zl: %f, bczs: %f, bcl: %d, bcd: %d\n", z_last, best_chunk_z_start, best_chunk_len, best_chunk_diff);
// printf ("slices_after: %d\n", slices_after);
dim[2] = slices_before + best_chunk_len + slices_after;
spacing[2] = best_chunk_diff;
float origin_diff[3] = {
slices_before * dc[2], slices_before * dc[5], slices_before * dc[8] };
vec3_add (origin, origin_diff);
slices_before * best_chunk_diff * dc[2],
slices_before * best_chunk_diff * dc[5],
slices_before * best_chunk_diff * dc[8] };
vec3_sub2 (origin, origin_diff);
/* Store image header */
if (d_ptr->rt_study_metadata) {
......@@ -407,7 +415,6 @@ Dcmtk_rt_study::image_load ()
best_slice_it = it;
}
}
/* Load the slice image data into volume */
df = (*best_slice_it).get();
......