[med-svn] [plastimatch] 01/06: New upstream version 1.6.4+dfsg1

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Nov 30 11:01:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository plastimatch.

commit fd55a8336a96b8b7bf523eba4845b7d897a71e7a
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Wed Nov 30 10:19:43 2016 +0000

    New upstream version 1.6.4+dfsg1
---
 CMakeLists.txt                                     | 126 ++++------
 Testing/CMakeLists.txt                             | 131 +++++-----
 Testing/CTestCustom.cmake.in                       |  22 +-
 src/CMakeLists.txt                                 |   4 +
 src/plastimatch/CHANGELOG.TXT                      |   9 +
 src/plastimatch/CMakeLists.txt                     |   4 +-
 src/plastimatch/base/dcmtk_image.cxx               | 273 ++++++++++-----------
 src/plastimatch/base/dcmtk_loader.cxx              |   6 +-
 src/plastimatch/base/dcmtk_loader_p.h              |   4 +-
 src/plastimatch/base/dcmtk_rt_study.cxx            |   8 +-
 src/plastimatch/base/dcmtk_rt_study_p.h            |   4 +-
 src/plastimatch/base/dcmtk_rtss.cxx                |  24 +-
 src/plastimatch/base/plm_image.cxx                 |   1 +
 src/plastimatch/base/rpl_volume.cxx                |   4 +-
 src/plastimatch/base/rtss.cxx                      |   2 +-
 src/plastimatch/base/rtss.h                        |   8 +-
 src/plastimatch/base/segmentation.cxx              |   2 +-
 src/plastimatch/base/slice_list.cxx                |  40 ++-
 src/plastimatch/dose/wed_parms.cxx                 |  14 +-
 src/plastimatch/plastimatch_version.txt            |   1 -
 src/plastimatch/register/bspline.cxx               |  51 ++--
 .../register/bspline_optimize_lbfgsb.cxx           |  14 +-
 src/plastimatch/register/bspline_parms.cxx         |   1 +
 src/plastimatch/register/bspline_parms.h           |   1 +
 src/plastimatch/register/bspline_stage.cxx         |   2 +
 src/plastimatch/register/bspline_state.cxx         |  17 +-
 src/plastimatch/register/registration_parms.cxx    |   6 +
 src/plastimatch/register/stage_parms.cxx           |   2 +
 src/plastimatch/register/stage_parms.h             |   1 +
 src/plastimatch/standalone/wed_main.cxx            |  32 ++-
 src/plastimatch/standalone/xvi_archive.cxx         |   5 +
 src/plastimatch/sys/plm_config.h.in                |   7 -
 src/plastimatch/sys/plm_version.h                  |  23 --
 src/plastimatch/sys/plm_version.h.in               |   9 +
 34 files changed, 449 insertions(+), 409 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b447126..8b24575 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,9 @@ project (plastimatch)
 ## The version here should be equal to the "next release"
 set (PLM_VERSION_MAJOR "1")
 set (PLM_VERSION_MINOR "6")
-set (PLM_VERSION_PATCH "3")
+set (PLM_VERSION_PATCH "4")
+#set (PLM_RELEASE_VERSION FALSE)
+set (PLM_RELEASE_VERSION TRUE)
 
 ##-----------------------------------------------------------------------------
 ##  Set up CMake defaults
@@ -52,10 +54,11 @@ option (PLM_CONFIG_DISABLE_QT "Set to ON to build without QT" OFF)
 option (PLM_CONFIG_DISABLE_REG23 "Disable building REG-2-3" OFF)
 option (PLM_CONFIG_DISABLE_SSE2 "Set to ON to build without SSE" OFF)
 option (PLM_CONFIG_ENABLE_MATLAB "Set to ON to build Matlab plugins" OFF)
-set (PLM_CONFIG_VERSION_STRING "" CACHE STRING "Version string")
-option (PLM_CONFIG_LIBRARY_BUILD "Set to ON to build only libraries" OFF)
-option (PLM_CONFIG_DEBIAN_BUILD "Set to ON to configure build for debian" OFF)
+
 option (PLM_CONFIG_BUILD_QT_PLUGINS "Build QT4 Designer Plugins?" OFF)
+option (PLM_CONFIG_DEBIAN_BUILD "Set to ON to configure build for debian" OFF)
+option (PLM_CONFIG_LIBRARY_BUILD "Set to ON to build only libraries" OFF)
+option (PLM_CONFIG_NOMANIFEST "Set to ON to build windows DLLs without manifests" OFF)
 
 # Compile and link options
 option (PLM_SUPERBUILD "Download missing external libraries" OFF)
@@ -180,21 +183,6 @@ include (cmake/CheckEpsilon)
 include (cmake/CheckCharSign)
 
 ##-----------------------------------------------------------------------------
-##  Figure out plastimatch version number
-##-----------------------------------------------------------------------------
-# For ordinary versions from svn, use the version number at the 
-# top of the file
-set (PLM_DEFAULT_VERSION_STRING
-  "${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH}")
-
-# For official releases, a special file gets included, which contains 
-# the version number
-if (EXISTS "${CMAKE_SOURCE_DIR}/src/plastimatch/plastimatch_version.txt")
-  file (READ "${CMAKE_SOURCE_DIR}/src/plastimatch/plastimatch_version.txt"
-    PLM_RELEASE_VERSION_STRING)
-endif ()
-
-##-----------------------------------------------------------------------------
 ##  Processor and OS characteristics
 ##    32-bit or 64-bit machine
 ##    Endian-ness
@@ -371,6 +359,7 @@ find_package (Dlib)
 find_package (Etags)
 #find_package (Fann)
 find_package (FFTW)
+find_package (Git)
 find_package (Liblbfgs)
 find_package (NLopt)
 if (PLM_CONFIG_ENABLE_MATLAB)
@@ -396,7 +385,6 @@ if (NOT PLM_CONFIG_DISABLE_SSE2)
 else ()
   set (SSE2_FOUND false)
 endif ()
-find_package (Subversion)
 find_package (TR1)
 find_package (wxWidgets)
 
@@ -590,32 +578,32 @@ else ()
 endif ()
 
 ##-----------------------------------------------------------------------------
-##  Get build number from subversion 
+##  Set version string
 ##-----------------------------------------------------------------------------
-set (PLASTIMATCH_SVN_VERSION "EXPERIMENTAL")
-if (EXISTS "${CMAKE_SOURCE_DIR}/.svn")
-  if (Subversion_FOUND)
-    set (PLASTIMATCH_HAVE_BUILD_NUMBER TRUE)
-    #Subversion_WC_INFO(${CMAKE_SOURCE_DIR} "svn")
-    execute_process (
-      COMMAND 
-      ${Subversion_SVNVERSION_EXECUTABLE} "--no-newline" 
-      WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
-      RESULT_VARIABLE svn_result
-      OUTPUT_VARIABLE svn_version
-      ERROR_VARIABLE svn_error
-      )
-    if (${svn_result} EQUAL 0)
-      message (STATUS "Looking for version in svn - found ${svn_version}")
-      set (PLASTIMATCH_SVN_VERSION ${svn_version})
-    else ()
-      message (STATUS "Looking for version in svn - can't connect")
-    endif ()
+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 (NOT PLM_RELEASE_VERSION)
+  set (PLASTIMATCH_VERSION_STRING "${PLASTIMATCH_VERSION_STRING}-dev")
+endif ()
+if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
+  execute_process (
+    COMMAND 
+    #${GIT_EXECUTABLE} rev-list --first-parent --count HEAD
+    ${GIT_EXECUTABLE} describe --always
+    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+    RESULT_VARIABLE git_result
+    OUTPUT_VARIABLE git_version
+    ERROR_VARIABLE git_error
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+  if (${git_result} EQUAL 0)
+    message (STATUS "Looking for version in git - found ${git_version}")
+    set (PLASTIMATCH_VERSION_STRING "${PLASTIMATCH_VERSION_STRING} (${git_version})")
   else ()
-    message (STATUS "Looking for version in svn - svn not found")
+    message (STATUS "Looked for version in git but failed")
   endif ()
-else ()
-  set (PLASTIMATCH_HAVE_BUILD_NUMBER FALSE)
 endif ()
 
 ##-----------------------------------------------------------------------------
@@ -811,11 +799,6 @@ find_package (LibYAML)
 ##  Configure include files
 ##-----------------------------------------------------------------------------
 set (PLM_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
-#configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/plastimatch/plm_config.h.in
-#  ${CMAKE_CURRENT_BINARY_DIR}/plm_config.h)
-
-#configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/plastimatch/plm_fortran.h.in
-#  ${CMAKE_CURRENT_BINARY_DIR}/plm_fortran.h)
 
 ##-----------------------------------------------------------------------------
 ##  Subdirectories
@@ -935,9 +918,9 @@ endif ()
 if (WIN32 OR WIN64)
   set (PLM_WINDOWS_INSTALL_DIR "${CMAKE_SOURCE_DIR}/extra/windows-install")
   install (DIRECTORY "${PLM_WINDOWS_INSTALL_DIR}/sample" DESTINATION bin)
-  install (FILES "${PLM_WINDOWS_INSTALL_DIR}/colormap_customgamma.txt}" DESTINATION bin)
-  install (FILES "${PLM_WINDOWS_INSTALL_DIR}/colormap_jet.txt}" DESTINATION bin)
-  install (FILES "${PLM_WINDOWS_INSTALL_DIR}/launch_command_prompt.txt}" DESTINATION bin)
+  install (FILES "${PLM_WINDOWS_INSTALL_DIR}/colormap_customgamma.txt" DESTINATION bin)
+  install (FILES "${PLM_WINDOWS_INSTALL_DIR}/colormap_jet.txt" DESTINATION bin)
+  install (FILES "${PLM_WINDOWS_INSTALL_DIR}/launch_cmd_prompt.bat" DESTINATION bin)
 endif ()
 
 # JAS 2011.01.24
@@ -1096,6 +1079,7 @@ set (CPACK_SOURCE_GENERATOR "TBZ2")
 set (CPACK_MONOLITHIC_INSTALL 1)
 
 # General stuff
+set (CPACK_INSTALL_PREFIX "")
 set (CPACK_PACKAGE_CONTACT "plastimatch at googlegroups.com")
 set (CPACK_PACKAGE_NAME "plastimatch")
 set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Plastimatch - A Medical Imaging Application")
@@ -1103,9 +1087,10 @@ set (CPACK_PACKAGE_VENDOR "Plastimatch Dev Team")
 set (CPACK_PACKAGE_VERSION_MAJOR "${PLM_VERSION_MAJOR}")
 set (CPACK_PACKAGE_VERSION_MINOR "${PLM_VERSION_MINOR}")
 set (CPACK_PACKAGE_VERSION_PATCH "${PLM_VERSION_PATCH}")
-set (CPACK_PACKAGE_VERSION_TWEAK ${PLASTIMATCH_SVN_VERSION})
+set (CPACK_PACKAGE_VERSION_TWEAK ${PLASTIMATCH_REPOSITORY_VERSION})
 set (CPACK_SOURCE_IGNORE_FILES
-  "/.svn"
+  "/\\\\.git"
+  "/\\\\.svn"
   "~$"
 )
 
@@ -1114,43 +1099,18 @@ set (CPACK_SOURCE_IGNORE_FILES
 set (CPACK_NSIS_HELP_LINK "http://plastimatch.org")
 set (CPACK_NSIS_URL_INFO_ABOUT "http://plastimatch.org")
 set (CPACK_NSIS_CONTACT "plastimatch at googlegroups.com")
-set (PLM_NSIS_VERSION_STRING "${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH} (${PLASTIMATCH_SVN_VERSION})")
+set (PLM_NSIS_VERSION_STRING "${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH} (${PLASTIMATCH_REPOSITORY_VERSION})")
 
 # WIX stuff
 set (CPACK_WIX_HELP_LINK "http://plastimatch.org")
 set (CPACK_WIX_UPGRADE_GUID "AA7C7964-14D7-4890-9CD1-EA1D80E4DC8C")
+set (CPACK_WIX_LICENSE_RTF  "${PLM_WINDOWS_INSTALL_DIR}/License.rtf")
+set (CPACK_WIX_UI_BANNER  "${PLM_WINDOWS_INSTALL_DIR}/plm_logo.jpg")
+set (CPACK_WIX_UI_DIALOG  "${PLM_WINDOWS_INSTALL_DIR}/plm_logo_GUI.jpg")
 
-# Write files to extra_stuff directory.  These is sets the release date 
-# and version number correctly into the changelog, without needing 
-# to commit these changes into the svn repository.
-file (WRITE "${CMAKE_BINARY_DIR}/extra_stuff/plastimatch_version.txt" 
-  "${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH} (${PLASTIMATCH_SVN_VERSION})")
-execute_process (COMMAND date
-  RESULT_VARIABLE DATE_RESULT
-  OUTPUT_VARIABLE DATE_OUTPUT
-  ERROR_VARIABLE DATE_ERROR
-  OUTPUT_STRIP_TRAILING_WHITESPACE)
-if (DATE_RESULT EQUAL 0)
-  set (TIMESTAMP ${DATE_OUTPUT})
-else ()
-  set (TIMESTAMP "Unknown")
-endif ()
-configure_file (
-  ${CMAKE_SOURCE_DIR}/src/plastimatch/CHANGELOG.TXT
-  ${CMAKE_BINARY_DIR}/extra_stuff/CHANGELOG.TXT
-  @ONLY)
-set (CPACK_SOURCE_INSTALLED_DIRECTORIES
-  "${CMAKE_SOURCE_DIR};/;${CMAKE_BINARY_DIR}/extra_stuff;/src/plastimatch")
-
-## GCS 2012-09-27 Trying to fix "make package" under linux.
-## c.f. http://www.cmake.org/pipermail/cmake/2011-July/045602.html
-#set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
-#set (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
-#set (CPACK_PACKAGING_INSTALL_PREFIX "")
-
+# ZIP stuff
 if (CPACK_GENERATOR STREQUAL "ZIP")
   set (CPACK_SET_DESTDIR ON)
 endif ()
-set (CPACK_INSTALL_PREFIX "")
 
 include (CPack)
diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt
index 78a7210..10455f6 100644
--- a/Testing/CMakeLists.txt
+++ b/Testing/CMakeLists.txt
@@ -132,10 +132,17 @@ macro (plm_download_and_extract DOWNLOAD_URL DOWNLOAD_FILENAME DOWNLOAD_DIR)
   if (NOT IS_DIRECTORY "${PLM_TESTING_DOWNLOAD_DATA_DIR}")
     file (MAKE_DIRECTORY "${PLM_TESTING_DOWNLOAD_DATA_DIR}")
   endif ()
-  if (NOT EXISTS ${DOWNLOAD_FILENAME})
-    message (STATUS "Downloading test data")
-    file (DOWNLOAD "${DOWNLOAD_URL}" "${DOWNLOAD_FILENAME}")
-  endif ()
+  set (download_retries 3)
+  while (NOT EXISTS ${DOWNLOAD_FILENAME} AND download_retries)
+    message (STATUS "Downloading test data: ${DOWNLOAD_FILENAME}")
+    file (DOWNLOAD "${DOWNLOAD_URL}" "${DOWNLOAD_FILENAME}"
+      STATUS download_status)
+    message (STATUS "Download status[${download_retries}]: ${download_status}")
+    list (GET download_status 0 dl_status)
+    if (dl_status)
+      math (EXPR download_retries "${download_retries}-1")
+    endif ()
+  endwhile ()
   if (NOT EXISTS ${DOWNLOAD_DIR})
     message (STATUS "Untarring test data: ${DOWNLOAD_FILENAME}")
     execute_process (
@@ -150,69 +157,63 @@ macro (plm_download_and_extract DOWNLOAD_URL DOWNLOAD_FILENAME DOWNLOAD_DIR)
 endmacro ()
 
 if (PLM_DOWNLOAD_TEST_DATA)
-  plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/1929/headphantom.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/headphantom.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/headphantom")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/1613/foot-dicomrt-aw-4.4.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/foot-dicomrt-aw-4.4.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/foot-dicomrt-aw-4.4")
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/dicomrt-33-structures.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-33-structures.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/dicomrt-33-structures")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/1632/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011")
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/dicomrt-aw-4.4-foot.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-aw-4.4-foot.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/dicomrt-aw-4.4-foot")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/2160/dicomrt-corvus-6.2.2.tar.gz"
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/dicomrt-corvus-6.2.2.tar.gz/download"
     "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-corvus-6.2.2.tar.gz"
     "${PLM_BUILD_TESTING_DIR}/dicomrt-corvus-6.2.2")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/2162/dicomrt_xio-4.60-irregular-spacing.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt_xio-4.60-irregular-spacing.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/xio-4.60-irregular-spacing")
-
-  plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/1187/rando-dicomrt-pinnacle3-8.2g.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/rando-dicomrt-pinnacle3-8.2g.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/rando-dicomrt-pinnacle3-8.2g")
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/dicomrt-pinnacle3-8.2g-rando.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-pinnacle3-8.2g-rando.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/dicomrt-pinnacle3-8.2g-rando")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/934/chest-phantom-dicomrt-xio-4.33.02.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/chest-phantom-dicomrt-xio-4.33.02.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02")
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/dicomrt-xio-4.33.02-chest-phantom.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-xio-4.33.02-chest-phantom.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/2227/dicomrt-33-structures.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-33-structures.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/dicomrt-33-structures")
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/dicomrt-xio-4.60-irregular-spacing.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/dicomrt-xio-4.60-irregular-spacing.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.60-irregular-spacing")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/1127/varian-catphan.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/varian-catphan.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/varian-catphan")
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/headphantom.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/headphantom.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/headphantom")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/2159/rtog-corvus-6.2.2.tar.gz"
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/rtog-corvus-6.2.2.tar.gz/download"
     "${PLM_TESTING_DOWNLOAD_DATA_DIR}/rtog-corvus-6.2.2.tar.gz"
     "${PLM_BUILD_TESTING_DIR}/rtog-corvus-6.2.2")
 
   plm_download_and_extract (
-    "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/939/chest-phantom-xio-4.33.02.tar.gz"
-    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/chest-phantom-xio-4.33.02.tar.gz"
-    "${PLM_BUILD_TESTING_DIR}/chest-phantom-xio-4.33.02")
-endif ()
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/varian-catphan-subset.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/varian-catphan-subset.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/varian-catphan-subset")
+
+  plm_download_and_extract (
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/xio-4.33.02-chest-phantom.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/xio-4.33.02-chest-phantom.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/xio-4.33.02-chest-phantom")
+
+  plm_download_and_extract (
+    "https://sourceforge.net/projects/plastimatch/files/Sample%20Data/xio-4.60-irregular-spacing.tar.gz/download"
+    "${PLM_TESTING_DOWNLOAD_DATA_DIR}/xio-4.60-irregular-spacing.tar.gz"
+    "${PLM_BUILD_TESTING_DIR}/xio-4.60-irregular-spacing")
 
-#### This seems to be a duplicate of the dicom-rt data, not the xio data
-# if (PLM_DOWNLOAD_XIO_IRREGULAR)
-#   plm_download_and_extract (
-#     "http://forge.abcd.harvard.edu/gf/download/frsrelease/85/2163/xio-4.60-irregular-spacing.tar.gz"
-#     "${PLM_TESTING_DOWNLOAD_DATA_DIR}/xio-4.60-irregular-spacing.tar.gz"
-#     "${PLM_BUILD_TESTING_DIR}/20110509")
-# endif ()
+endif ()
 
 ## -------------------------------------------------------------------------
 ## Custom test command
@@ -950,7 +951,7 @@ set_tests_properties (fdk-cpu-a-check PROPERTIES DEPENDS fdk-cpu-a-stats)
 plm_add_test (
   "fdk-cpu-b"
   ${PLM_PLASTIMATCH_PATH}/fdk
-  "-I;${PLM_BUILD_TESTING_DIR}/varian-catphan;-f;none;-a;0 20 670;-O;${PLM_BUILD_TESTING_DIR}/fdk-cpu-b.mha"
+  "-I;${PLM_BUILD_TESTING_DIR}/varian-catphan-subset;-f;none;-a;0 20 670;-O;${PLM_BUILD_TESTING_DIR}/fdk-cpu-b.mha"
   )
 plm_add_test (
   "fdk-cpu-b-stats"
@@ -969,7 +970,7 @@ set_tests_properties (fdk-cpu-b-check PROPERTIES DEPENDS fdk-cpu-b-stats)
 plm_add_test (
   "fdk-cpu-c"
   ${PLM_PLASTIMATCH_PATH}/fdk
-  "-I;${PLM_BUILD_TESTING_DIR}/varian-catphan;-f;ramp;-a;0 50 670;-O;${PLM_BUILD_TESTING_DIR}/fdk-cpu-c.mha"
+  "-I;${PLM_BUILD_TESTING_DIR}/varian-catphan-subset;-f;ramp;-a;0 50 670;-O;${PLM_BUILD_TESTING_DIR}/fdk-cpu-c.mha"
   )
 plm_add_test (
   "fdk-cpu-c-stats"
@@ -1497,7 +1498,7 @@ plm_add_test (
 plm_add_test (
   "plm-convert-dicom-aw-a" 
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--dicom-with-uids;false;--input;${PLM_BUILD_TESTING_DIR}/foot-dicomrt-aw-4.4/20101202HFS;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-dose.mha;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-dicom"
+  "convert;--dicom-with-uids;false;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-aw-4.4-foot/20101202HFS;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-dose.mha;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-a-dicom"
   )
 plm_add_test (
   "plm-convert-dicom-aw-a-stats" 
@@ -1512,7 +1513,7 @@ plmtest_check_string ("plm-convert-dicom-aw-a-check"
 plm_add_test (
   "plm-convert-dicom-aw-b" 
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/foot-dicomrt-aw-4.4/20101202FFS;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b-dose.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-aw-4.4-foot/20101202FFS;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-aw-b-dose.mha"
   )
 set_tests_properties (plm-convert-dicom-aw-a-stats PROPERTIES 
   DEPENDS plm-convert-dicom-aw-a)
@@ -1522,11 +1523,11 @@ set_tests_properties (plm-convert-dicom-aw-a-check PROPERTIES
 ## -------------------------------------------------------------------------
 ## plastimatch convert dicom-rt (cerr)
 ## -------------------------------------------------------------------------
-plm_add_test (
-  "plm-convert-dicom-cerr-a" 
-  ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a-dose.mha"
-  )
+# plm_add_test (
+#   "plm-convert-dicom-cerr-a" 
+#   ${PLM_PLASTIMATCH_PATH}/plastimatch
+#   "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-cerr-a-dose.mha"
+#   )
 
 ## -------------------------------------------------------------------------
 ## plastimatch convert dicom-rt (corvus)
@@ -1543,7 +1544,7 @@ plm_add_test (
 plm_add_test (
   "plm-convert-dicom-pinnacle-a" 
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/rando-dicomrt-pinnacle3-8.2g;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a-dose.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-pinnacle3-8.2g-rando;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-pinnacle-a-dose.mha"
   )
 
 ## -------------------------------------------------------------------------
@@ -1560,7 +1561,7 @@ plm_add_test (
 plm_add_test (
   "plm-convert-dicom-xio-a"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-a.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-a.mha"
   )
 plm_add_test (
   "plm-convert-dicom-xio-a-stats"
@@ -1581,7 +1582,7 @@ set_tests_properties (plm-convert-dicom-xio-a-check PROPERTIES
 plm_add_test (
   "plm-convert-dicom-xio-b"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02/SS.rtp1.12.20080627A.5.dcm;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-b-ss.mha;--referenced-ct;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom/SS.rtp1.12.20080627A.5.dcm;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-b-ss.mha;--referenced-ct;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom"
   )
 plm_add_test (
   "plm-convert-dicom-xio-b-stats"
@@ -1602,7 +1603,7 @@ set_tests_properties (plm-convert-dicom-xio-b-check PROPERTIES
 plm_add_test (
   "plm-convert-dicom-xio-c"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02/SS.rtp1.12.20080627A.5.dcm;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-c-ss.mha;--fixed;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-a.mha;--output-cxt;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-c.cxt"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom/SS.rtp1.12.20080627A.5.dcm;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-c-ss.mha;--fixed;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-a.mha;--output-cxt;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-c.cxt"
   )
 plm_add_test (
   "plm-convert-dicom-xio-c-stats"
@@ -1626,7 +1627,7 @@ set_tests_properties (plm-convert-dicom-xio-c-check PROPERTIES
 plm_add_test (
   "plm-convert-dicom-xio-d"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02/DOSE.20080627A.TRAINING4FLD.dcm;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-d-dose-img.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom/DOSE.20080627A.TRAINING4FLD.dcm;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-d-dose-img.mha"
   )
 plm_add_test (
   "plm-convert-dicom-xio-d-stats"
@@ -1647,7 +1648,7 @@ set_tests_properties (plm-convert-dicom-xio-d-check PROPERTIES
 plm_add_test (
   "plm-convert-dicom-xio-e" 
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-e-dicom;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-e-dose-img.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-e-dicom;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-e-dose-img.mha"
   )
 
 plm_add_test (
@@ -1676,13 +1677,13 @@ set_tests_properties (plm-convert-dicom-xio-f-check PROPERTIES
 plm_add_test (
   "plm-convert-dicom-xio-g"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g-dose.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g.mha;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g-ss.mha;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g-ss.txt;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-dicom-xio-g-dose.mha"
   )
 
 plm_add_test (
   "plm-warp-dicom-xio-a" 
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "warp;--xf;${PLM_TESTING_DATA_DIR}/xf-bspline-chest-phantom.txt;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-dicom;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-ss.nrrd;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-ss.txt;--output-labelmap;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-labelmap.nrrd;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-img.nrrd;--outp [...]
+  "warp;--xf;${PLM_TESTING_DATA_DIR}/xf-bspline-chest-phantom.txt;--input;${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-dicom;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-ss.nrrd;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-ss.txt;--output-labelmap;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-labelmap.nrrd;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-dicom-xio-a-img.nrrd;--outp [...]
   )
 plm_add_test (
   "plm-warp-dicom-xio-a-stats-1"
@@ -1807,7 +1808,7 @@ set_tests_properties (plm-convert-cxt-check PROPERTIES
 plm_add_test (
   "plm-convert-xio-a"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-xio-4.33.02;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a.mha;--output-xio;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a-xio-output;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a-dicom;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a-dose.mha"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/xio-4.33.02-chest-phantom;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a.mha;--output-xio;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a-xio-output;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a-dicom;--output-dose-img;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-a-dose.mha"
   )
 plm_add_test (
   "plm-convert-xio-a-stats"
@@ -1828,7 +1829,7 @@ set_tests_properties (plm-convert-xio-a-check PROPERTIES
 plm_add_test (
   "plm-convert-xio-b"
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "convert;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-xio-4.33.02/20080627A/plan/TRAINING4FLD;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-b.mha;--output-xio;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-b-xio-output;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-b-dicom"
+  "convert;--input;${PLM_BUILD_TESTING_DIR}/xio-4.33.02-chest-phantom/20080627A/plan/TRAINING4FLD;--output-img;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-b.mha;--output-xio;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-b-xio-output;--output-dicom;${PLM_BUILD_TESTING_DIR}/plm-convert-xio-b-dicom"
   )
 plm_add_test (
   "plm-convert-xio-b-stats"
@@ -1849,7 +1850,7 @@ set_tests_properties (plm-convert-xio-b-check PROPERTIES
 plm_add_test (
   "plm-warp-xio-a" 
   ${PLM_PLASTIMATCH_PATH}/plastimatch
-  "warp;--xf;${PLM_TESTING_DATA_DIR}/xf-bspline-chest-phantom.txt;--input;${PLM_BUILD_TESTING_DIR}/chest-phantom-xio-4.33.02;--output-xio;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-xio;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-ss.nrrd;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-ss.txt;--output-labelmap;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-labelmap.nrrd;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-img.nrrd;--output-prefix;${PLM_BUILD_TESTING_DIR}/plm-war [...]
+  "warp;--xf;${PLM_TESTING_DATA_DIR}/xf-bspline-chest-phantom.txt;--input;${PLM_BUILD_TESTING_DIR}/xio-4.33.02-chest-phantom;--output-xio;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-xio;--output-ss-img;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-ss.nrrd;--output-ss-list;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-ss.txt;--output-labelmap;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-labelmap.nrrd;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-xio-a-img.nrrd;--output-prefix;${PLM_BUILD_TESTING_DIR}/plm-war [...]
   )
 plm_add_test (
   "plm-warp-xio-a-stats-1"
@@ -4369,7 +4370,7 @@ plmtest_check_interval ("proton-dose-6a-check"
   "0.27"
   )
 set_tests_properties (proton-dose-6a PROPERTIES DEPENDS rect-17)
-set_tests_properties (proton-dose-6a PROPERTIES DEPENDS ptv-1)
+set_tests_properties (proton-dose-6a PROPERTIES DEPENDS ptv-2)
 set_tests_properties (proton-dose-6a-stats
     PROPERTIES DEPENDS proton-dose-6a)
 set_tests_properties (proton-dose-6a-check
diff --git a/Testing/CTestCustom.cmake.in b/Testing/CTestCustom.cmake.in
index 760959c..651a375 100644
--- a/Testing/CTestCustom.cmake.in
+++ b/Testing/CTestCustom.cmake.in
@@ -98,7 +98,7 @@ if (NOT CMAKE_Fortran_COMPILER_WORKS)
 endif ()
 
 ## If we didn't get XiO dicom-rt test data, don't run these tests
-if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02")
+if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/dicomrt-xio-4.33.02-chest-phantom")
   set (CTEST_CUSTOM_TESTS_IGNORE
     ${CTEST_CUSTOM_TESTS_IGNORE}
     "plm-convert-dicom-xio-a"
@@ -128,7 +128,7 @@ if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-xio-4.33.02")
 endif ()
 
 ## If we didn't get xio test data, don't run xio tests
-if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/chest-phantom-xio-4.33.02")
+if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/xio-4.33.02-chest-phantom")
   set (CTEST_CUSTOM_TESTS_IGNORE
     ${CTEST_CUSTOM_TESTS_IGNORE}
     "plm-convert-xio-a"
@@ -160,7 +160,7 @@ if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/rtog-corvus-6.2.2")
 endif ()
 
 ## If we didn't get aw (foot) test data, don't run these tests
-if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/foot-dicomrt-aw-4.4")
+if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/dicomrt-aw-4.4-foot")
   set (CTEST_CUSTOM_TESTS_IGNORE
     ${CTEST_CUSTOM_TESTS_IGNORE}
     "plm-convert-dicom-aw-a" 
@@ -171,12 +171,12 @@ if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/foot-dicomrt-aw-4.4")
 endif ()
 
 ## If we didn't get cerr test data, don't run these tests
-if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011")
-  set (CTEST_CUSTOM_TESTS_IGNORE
-    ${CTEST_CUSTOM_TESTS_IGNORE}
-    "plm-convert-dicom-cerr-a" 
-    )
-endif ()
+# if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/chest-phantom-dicomrt-CERR4pt0beta2_25_Jan_2011")
+#   set (CTEST_CUSTOM_TESTS_IGNORE
+#     ${CTEST_CUSTOM_TESTS_IGNORE}
+#     "plm-convert-dicom-cerr-a" 
+#     )
+# endif ()
 
 ## If we didn't get corvus test data, don't run these tests
 if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/dicomrt-corvus-6.2.2")
@@ -195,7 +195,7 @@ if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/xio-4.60-irregular-spacing")
 endif ()
 
 ## If we didn't get pinnacle test data, don't run these tests
-if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}//rando-dicomrt-pinnacle3-8.2g")
+if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/dicomrt-pinnacle3-8.2g-rando")
   set (CTEST_CUSTOM_TESTS_IGNORE
     ${CTEST_CUSTOM_TESTS_IGNORE}
     "plm-convert-dicom-pinnacle-a" 
@@ -215,7 +215,7 @@ if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/dicomrt-33-structures")
 endif ()
 
 ## If we didn't get varian fdk test data, don't run these tests
-if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/varian-catphan")
+if (NOT EXISTS "${PLM_BUILD_TESTING_DIR}/varian-catphan-subset")
   set (CTEST_CUSTOM_TESTS_IGNORE
     ${CTEST_CUSTOM_TESTS_IGNORE}
     "fdk-cpu-b"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 416f887..a618813 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -80,6 +80,10 @@ if (UNIX AND NOT PLM_PREFER_NO_FORTRAN_NO_F2C AND NOT PLM_USE_INCLUDED_F2C)
   set (PLASTIMATCH_LDFLAGS "${PLASTIMATCH_LDFLAGS} -u MAIN__")
 endif ()
 
+if (PLM_CONFIG_NOMANIFEST AND WIN32)
+  set (PLASTIMATCH_LDFLAGS "${PLASTIMATCH_LDFLAGS} /MANIFEST:NO")
+endif ()
+
 ##-----------------------------------------------------------------------------
 ##  Add subdirectories
 ##-----------------------------------------------------------------------------
diff --git a/src/plastimatch/CHANGELOG.TXT b/src/plastimatch/CHANGELOG.TXT
index 03d0af6..9238e97 100644
--- a/src/plastimatch/CHANGELOG.TXT
+++ b/src/plastimatch/CHANGELOG.TXT
@@ -1,3 +1,12 @@
+Version 1.6.4 (tag v1.6.4)
+Tue Aug  9 18:15:58 EDT 2016
+* Convert to new gitlab host
+* Windows binary fixes
+* Allow building DLLs without manifests
+* Re-enable wed code
+* Fix incorrect CUDA initialization when not being used
+* Add lbfgsb_mmax option to registration parameter file
+
 Version 1.6.3 (build 5341)
 Wed Jun 29 17:08:12 EDT 2016
 * WiX based windows install
diff --git a/src/plastimatch/CMakeLists.txt b/src/plastimatch/CMakeLists.txt
index 6e68510..b027afb 100644
--- a/src/plastimatch/CMakeLists.txt
+++ b/src/plastimatch/CMakeLists.txt
@@ -136,6 +136,8 @@ endif ()
 ##-----------------------------------------------------------------------------
 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sys/plm_config.h.in
   ${PLM_BUILD_ROOT}/plm_config.h)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sys/plm_version.h.in
+  ${PLM_BUILD_ROOT}/plm_version.h)
 
 if (NOT PLM_PREFER_NO_FORTRAN_NO_F2C)
 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sys/plm_fortran.h.in
@@ -347,7 +349,7 @@ else (PLM_PACKAGE_LEGACY_CMAKE_CONFIG)
   # Make the version file
   write_basic_package_version_file (
     "${CMAKE_CURRENT_BINARY_DIR}/PlastimatchConfigVersion.cmake"
-    VERSION ${PLM_DEFAULT_VERSION_STRING}
+    VERSION ${PLM_BASIC_VERSION_STRING}
     COMPATIBILITY AnyNewerVersion
     )
 
diff --git a/src/plastimatch/base/dcmtk_image.cxx b/src/plastimatch/base/dcmtk_image.cxx
index 199ae43..3dd05f7 100755
--- a/src/plastimatch/base/dcmtk_image.cxx
+++ b/src/plastimatch/base/dcmtk_image.cxx
@@ -27,6 +27,7 @@
 #include "plm_uid_prefix.h"
 #include "plm_version.h"
 #include "print_and_exit.h"
+#include "slice_list.h"
 #include "string_util.h"
 #include "volume.h"
 
@@ -39,101 +40,93 @@ Dcmtk_loader::image_load ()
 
     /* Make abbreviations */
     Dcmtk_series *ds_image = d_ptr->ds_image;
-    const Dcmtk_file_list& flist = ds_image->get_flist ();
+    const Dcmtk_file_list& ds_flist = ds_image->get_flist ();
 
     /* Create a container to hold different groups of files */
     std::list<Dcmtk_file_list> group_list;
 
     /* Arrange files into groups according to direction cosines */
+    for (Dcmtk_file_list::const_iterator it = ds_flist.begin();
+         it != ds_flist.end(); ++it)
     {
-        //printf ("----------\n");
-        Dcmtk_file_list::const_iterator it;
-        for (it = flist.begin(); it != flist.end(); ++it) {
-            const Dcmtk_file::Pointer& df = (*it);
-
-            //df->debug ();
-
-            bool match_found = false;
-            std::list<Dcmtk_file_list>::iterator grit;
-            for (grit = group_list.begin(); grit != group_list.end(); ++grit) {
-                Dcmtk_file_list& flp = *grit;
-                const Dcmtk_file::Pointer& flp_df = flp.front();
-
-                if (flp_df->get_direction_cosines() 
-                    == df->get_direction_cosines())
-                {
-                    /* Add logic to append to flp */
-                    //printf ("Match found.  :)\n");
-                    match_found = true;
-                    flp.push_back (df);
-                    break;
-                }
-            }
-            if (match_found) {
-                continue;
+        const Dcmtk_file::Pointer& df = (*it);
+        bool match_found = false;
+        std::list<Dcmtk_file_list>::iterator grit;
+        for (grit = group_list.begin(); grit != group_list.end(); ++grit) {
+            Dcmtk_file_list& flp = *grit;
+            const Dcmtk_file::Pointer& flp_df = flp.front();
+
+            if (flp_df->get_direction_cosines() 
+                == df->get_direction_cosines())
+            {
+                /* Add logic to append to flp */
+                //printf ("Match found.  :)\n");
+                match_found = true;
+                flp.push_back (df);
+                break;
             }
-            /* Else insert new element into group_list */
-            //printf ("Need to insert.\n");
-            group_list.push_back (Dcmtk_file_list());
-            group_list.back().push_back (df);
         }
-        //printf ("----------\n");
+        if (match_found) {
+            continue;
+        }
+        /* Else insert new element into group_list */
+        group_list.push_back (Dcmtk_file_list());
+        group_list.back().push_back (df);
     }
 
-    /* Sort each group in Z direction */
-    {
+    /* If multiple groups, emit a warning.  Choose the largest group. */
+    Dcmtk_file_list *flist = &group_list.front ();
+    if (group_list.size() > 1) {
+        lprintf ("Warning, DICOM series with multiple direction cosines\n");
         std::list<Dcmtk_file_list>::iterator grit;
         for (grit = group_list.begin(); grit != group_list.end(); ++grit) {
-            grit->sort();
+            if ((*grit).size() > flist->size()) {
+                flist = &*grit;
+            }
         }
     }
+    
+    /* Sort group in Z direction */
+    flist->sort (dcmtk_file_compare_z_position);
 
-    /* Regroup as needed according to inter-slice spacing */
-    {
-    }
-
-    /* Sort in Z direction */
-    ds_image->sort ();
-
-    /* GCS FIX:
-       (1) Direction cosines
-       (2) Minimum 2 slices
-       (3) Consistency of images w/in series
-       (4) done
-       (5) Different image types
-       (6) Refine slice spacing based on entire chunk size
-    */
+    /* 
+     * GCS FIX:
+     * Remove minimum 2 slices requirement
+     * Check consistency (dim, origin) of images w/in series
+     * Different image types
+     * Refine slice spacing based on entire chunk size
+     */
 
     /* Check for minimum 2 slices */
-    if (flist.size() < 2) {
+    if (flist->size() < 2) {
         return;
     }
 
     /* Get first slice */
-    const Dcmtk_file* df = (*flist.begin()).get();
+    const Dcmtk_file* df = (*flist->begin()).get();
     
     /* Store UIDs */
-    if (d_ptr->m_drs) {
-        d_ptr->m_drs->set_ct_series_uid (
+    if (d_ptr->rt_meta) {
+        d_ptr->rt_meta->set_ct_series_uid (
             df->get_cstr (DCM_SeriesInstanceUID));
-        d_ptr->m_drs->set_frame_of_reference_uid (
+        d_ptr->rt_meta->set_frame_of_reference_uid (
             df->get_cstr (DCM_FrameOfReferenceUID));
-        d_ptr->m_drs->set_study_uid (
+        d_ptr->rt_meta->set_study_uid (
             df->get_cstr (DCM_StudyInstanceUID));
-        d_ptr->m_drs->set_study_date (
+        d_ptr->rt_meta->set_study_date (
             df->get_cstr (DCM_StudyDate));
-        d_ptr->m_drs->set_study_time (
+        d_ptr->rt_meta->set_study_time (
             df->get_cstr (DCM_StudyTime));
 
         /* Store remaining metadata */
-        Metadata::Pointer& study_metadata = d_ptr->m_drs->get_study_metadata ();
+        Metadata::Pointer& study_metadata = d_ptr->rt_meta->get_study_metadata ();
         dcmtk_copy_into_metadata (study_metadata, df, DCM_PatientName);
         dcmtk_copy_into_metadata (study_metadata, df, DCM_PatientID);
         dcmtk_copy_into_metadata (study_metadata, df, DCM_PatientSex);
         dcmtk_copy_into_metadata (study_metadata, df, DCM_PatientPosition);
         dcmtk_copy_into_metadata (study_metadata, df, DCM_StudyID);
 
-        Metadata::Pointer& image_metadata = d_ptr->m_drs->get_image_metadata ();
+        Metadata::Pointer& image_metadata = d_ptr->rt_meta->get_image_metadata ();
         dcmtk_copy_into_metadata (image_metadata, df, DCM_Modality);
     }
 
@@ -175,6 +168,7 @@ Dcmtk_loader::image_load ()
         rescale_slope = 1;
     }
 
+#if defined (commentout)
     lprintf ("Samp_per_pix: %d\n", (int) samp_per_pix);
     lprintf ("Phot_interp: %s\n", phot_interp);
     lprintf ("Bits_alloc: %d\n", (int) bits_alloc);
@@ -182,7 +176,8 @@ Dcmtk_loader::image_load ()
     lprintf ("High_bit: %d\n", (int) high_bit);
     lprintf ("Pixel_rep: %d\n", (int) pixel_rep);
     lprintf ("S/I = %f/%f\n", rescale_slope, rescale_intercept);
-
+#endif
+    
     /* Some kinds of images we don't know how to deal with.  
        Don't load these. */
     if (samp_per_pix != 1) {
@@ -210,85 +205,78 @@ Dcmtk_loader::image_load ()
        into a PLM_IMG_TYPE_GPUIT_LIST */
 #if (PLM_CONFIG_VOL_LIST)
 
-    /* Loop through groups */
-    std::list<Dcmtk_file_list>::iterator grit;
-    for (grit = group_list.begin(); grit != group_list.end(); ++grit) {
+    /* Get first slice of group */
+    Dcmtk_file_list::iterator it = flist->begin();
+    df = it->get();
 
-        //Dcmtk_file_list& dfl = *grit;
+    /* 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 first slice of group */
-        Dcmtk_file_list::iterator it = grit->begin();
-        const Dcmtk_file* df = it->get();
+    ++it; ++slice_no;
+    df = (*it).get();
+    z_diff = df->get_z_position() - z_prev;
+    z_last = z_prev = df->get_z_position();
 
-        /* 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 ();
+    /* We want to find the number and spacing for each chunk 
+       within the group.  These are used to set the dim and 
+       spacing of the volume. */
+    int this_chunk_start = 0, best_chunk_start = 0;
+    float this_chunk_diff = z_diff, best_chunk_diff = z_diff;
+    int this_chunk_len = 2, best_chunk_len = 2;
 
-        ++it; ++slice_no;
+    /* Loop through remaining slices */
+    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();
 
-        /* We want to find the number and spacing for each chunk 
-           within the group.  These are used to set the dim and 
-           spacing of the volume. */
-        int this_chunk_start = 0, best_chunk_start = 0;
-        float this_chunk_diff = z_diff, best_chunk_diff = z_diff;
-        int this_chunk_len = 2, best_chunk_len = 2;
-
-        /* Loop through remaining slices */
-        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();
-
-            if (fabs (this_chunk_diff - z_diff) > 0.11) {
-                /* Start a new chunk if difference in thickness is 
-                   more than 0.1 millimeter */
-                this_chunk_start = slice_no - 1;
-                this_chunk_len = 2;
-                this_chunk_diff = z_diff;
-            } else {
-                /* Same thickness, increase size of this chunk */
-                this_chunk_diff = ((this_chunk_len * this_chunk_diff) + z_diff)
-                    / (this_chunk_len + 1);
-                this_chunk_len++;
-
-                /* Check if this chunk is now the best chunk */
-                if (this_chunk_len > best_chunk_len) {
-                    best_chunk_start = this_chunk_start;
-                    best_chunk_len = this_chunk_len;
-                    best_chunk_diff = this_chunk_diff;
-                    best_chunk_z_start = z_prev 
-                        - (best_chunk_len-1) * best_chunk_diff;
-                }
+        if (fabs (this_chunk_diff - z_diff) > 0.11) {
+            /* Start a new chunk if difference in thickness is 
+               more than 0.1 millimeter */
+            this_chunk_start = slice_no - 1;
+            this_chunk_len = 2;
+            this_chunk_diff = z_diff;
+        } else {
+            /* Same thickness, increase size of this chunk */
+            this_chunk_diff = ((this_chunk_len * this_chunk_diff) + z_diff)
+                / (this_chunk_len + 1);
+            this_chunk_len++;
+
+            /* Check if this chunk is now the best chunk */
+            if (this_chunk_len > best_chunk_len) {
+                best_chunk_start = this_chunk_start;
+                best_chunk_len = this_chunk_len;
+                best_chunk_diff = this_chunk_diff;
+                best_chunk_z_start = z_prev 
+                    - (best_chunk_len-1) * best_chunk_diff;
             }
         }
+    }
 
 #if defined (commentout)        
-        Dcmtk_file_list& flp = *grit;
-        const Dcmtk_file::Pointer dfp = grit->front();
-        Volume::Pointer vol = Volume::New (
-            const plm_long dim[3], 
-            const float origin[3], 
-            const float spacing[3], 
-            &dfp->get_direction_cosines(),
-            vh,
-            PT_FLOAT, 1);
+    Dcmtk_file_list& flp = *grit;
+    const Dcmtk_file::Pointer dfp = grit->front();
+    Volume::Pointer vol = Volume::New (
+        const plm_long dim[3], 
+        const float origin[3], 
+        const float spacing[3], 
+        &dfp->get_direction_cosines(),
+        vh,
+        PT_FLOAT, 1);
 #endif
-    }
 
-#else
+#else /* NOT VOL_LIST */
     /* Get next slice in 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 ();
 
-    std::list<Dcmtk_file::Pointer>::const_iterator it = flist.begin();
+    std::list<Dcmtk_file::Pointer>::const_iterator it = flist->begin();
     ++it; ++slice_no;
     df = (*it).get();
     z_diff = df->get_z_position() - z_prev;
@@ -298,10 +286,10 @@ Dcmtk_loader::image_load ()
        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;
-    int this_chunk_len = 2, best_chunk_len = 2;
+    size_t this_chunk_len = 2, best_chunk_len = 2;
 
     /* Loop through remaining slices */
-    while (++it != flist.end())
+    while (++it != flist->end())
     {
 	++slice_no;
 	df = (*it).get();
@@ -332,18 +320,21 @@ Dcmtk_loader::image_load ()
     }
 
     /* Report information about best chunk */
-    lprintf ("Best chunck:\n  Slices %d to %d from (0 to %d)\n"
-	"  Z_loc = %f %f\n" 
-	"  Slice spacing = %f\n", 
-	best_chunk_start, best_chunk_start + best_chunk_len - 1, slice_no, 
-	best_chunk_z_start, 
-	best_chunk_z_start + (best_chunk_len - 1) * best_chunk_diff, 
-	best_chunk_diff);
-
+    if (best_chunk_len != flist->size()) {
+        lprintf ("** Warning, inequal slice spacing detected when loading DICOM.\n");
+        lprintf ("Best chunck:\n  Slices %d to %d from (0 to %d)\n"
+            "  Z_loc = %f %f\n" 
+            "  Slice spacing = %f\n", 
+            best_chunk_start, best_chunk_start + best_chunk_len - 1, slice_no, 
+            best_chunk_z_start, 
+            best_chunk_z_start + (best_chunk_len - 1) * best_chunk_diff, 
+            best_chunk_diff);
+    }
+    
     /* Some debugging info */
 #if defined (commentout)
     lprintf ("Slices: ");
-    for (it = flist.begin(); it != flist.end(); ++it) {
+    for (it = flist->begin(); it != flist->end(); ++it) {
         df = (*it).get();
 	lprintf ("%f ", df->get_z_position());
     }
@@ -360,15 +351,15 @@ Dcmtk_loader::image_load ()
     int slices_after = 
 	ROUND_INT ((z_last - best_chunk_z_start 
 		- (best_chunk_len - 1) * best_chunk_diff) / best_chunk_diff);
-    df = (*flist.begin()).get();
+    df = (*flist->begin()).get();
     vh.clone (df->get_volume_header());
     dim[2] = slices_before + best_chunk_len + slices_after;
     vh.get_origin()[2] = best_chunk_z_start - slices_before * best_chunk_diff;
     vh.get_spacing()[2] = best_chunk_diff;
 
     /* Store image header */
-    if (d_ptr->m_drs) {
-        d_ptr->m_drs->set_image_header (Plm_image_header (vh));
+    if (d_ptr->rt_meta) {
+        d_ptr->rt_meta->set_image_header (Plm_image_header (vh));
     }
 
     /* More debugging info */
@@ -393,10 +384,10 @@ Dcmtk_loader::image_load ()
     for (plm_long i = 0; i < dim[2]; i++) {
 	/* Find the best slice, using nearest neighbor interpolation */
 	std::list<Dcmtk_file::Pointer>::const_iterator best_slice_it 
-            = flist.begin();
+            = flist->begin();
 	float best_z_dist = FLT_MAX;
 	float z_pos = vh.get_origin()[2] + i * vh.get_spacing()[2];
-	for (it = flist.begin(); it != flist.end(); ++it) {
+	for (it = flist->begin(); it != flist->end(); ++it) {
 	    float this_z_dist = fabs ((*it)->get_z_position() - z_pos);
 	    if (this_z_dist < best_z_dist) {
 		best_z_dist = this_z_dist;
@@ -446,13 +437,13 @@ Dcmtk_loader::image_load ()
 	img += length;
 
 	/* Store slice UID */
-        if (d_ptr->m_drs) {
-            d_ptr->m_drs->set_slice_uid (i, df->get_cstr (DCM_SOPInstanceUID));
+        if (d_ptr->rt_meta) {
+            d_ptr->rt_meta->set_slice_uid (i, df->get_cstr (DCM_SOPInstanceUID));
         }
     }
-#endif
-    if (d_ptr->m_drs) {
-        d_ptr->m_drs->set_slice_list_complete ();
+#endif /* NOT VOL_LIST */
+    if (d_ptr->rt_meta) {
+        d_ptr->rt_meta->set_slice_list_complete ();
     }
 }
 
diff --git a/src/plastimatch/base/dcmtk_loader.cxx b/src/plastimatch/base/dcmtk_loader.cxx
index e6a004a..17f0129 100755
--- a/src/plastimatch/base/dcmtk_loader.cxx
+++ b/src/plastimatch/base/dcmtk_loader.cxx
@@ -54,7 +54,7 @@ Dcmtk_loader::~Dcmtk_loader ()
 void
 Dcmtk_loader::set_rt_study_metadata (Rt_study_metadata::Pointer drs)
 {
-    d_ptr->m_drs = drs;
+    d_ptr->rt_meta = drs;
 }
 
 void
@@ -167,7 +167,7 @@ Dcmtk_loader::get_image ()
 Rtss::Pointer
 Dcmtk_loader::get_rtss ()
 {
-    return d_ptr->cxt;
+    return d_ptr->rtss;
 }
 
 Plm_image::Pointer
@@ -228,7 +228,7 @@ Dcmtk_loader::parse_directory (void)
 
     /* Load image */
     if (d_ptr->ds_image) {
-        d_ptr->ds_image->set_rt_study_metadata (d_ptr->m_drs);
+        d_ptr->ds_image->set_rt_study_metadata (d_ptr->rt_meta);
         this->image_load ();
     }
 
diff --git a/src/plastimatch/base/dcmtk_loader_p.h b/src/plastimatch/base/dcmtk_loader_p.h
index ae338fb..7ae4a04 100755
--- a/src/plastimatch/base/dcmtk_loader_p.h
+++ b/src/plastimatch/base/dcmtk_loader_p.h
@@ -20,11 +20,11 @@ typedef std::pair<std::string, Dcmtk_series*> Dcmtk_series_map_pair;
 
 class Dcmtk_loader_private {
 public:
-    Rt_study_metadata::Pointer m_drs;
+    Rt_study_metadata::Pointer rt_meta;
 
     Plm_image::Pointer img;
     Plm_image::Pointer dose;
-    Rtss::Pointer cxt;
+    Rtss::Pointer rtss;
 
 public:
     Dcmtk_series_map m_smap;
diff --git a/src/plastimatch/base/dcmtk_rt_study.cxx b/src/plastimatch/base/dcmtk_rt_study.cxx
index df7ec6b..085207f 100755
--- a/src/plastimatch/base/dcmtk_rt_study.cxx
+++ b/src/plastimatch/base/dcmtk_rt_study.cxx
@@ -117,13 +117,13 @@ Dcmtk_rt_study::set_image (Plm_image::Pointer image)
 Rtss::Pointer&
 Dcmtk_rt_study::get_rtss ()
 {
-    return d_ptr->cxt;
+    return d_ptr->rtss;
 }
 
 void 
 Dcmtk_rt_study::set_rtss (Rtss::Pointer rtss)
 {
-    d_ptr->cxt = rtss;
+    d_ptr->rtss = rtss;
 }
 
 Plm_image::Pointer 
@@ -159,7 +159,7 @@ Dcmtk_rt_study::load (const char *dicom_path)
     dss.parse_directory ();
 
     d_ptr->img = dss.get_image ();
-    d_ptr->cxt = dss.get_rtss ();
+    d_ptr->rtss = dss.get_rtss ();
     d_ptr->dose = dss.get_dose ();
 }
 
@@ -178,7 +178,7 @@ Dcmtk_rt_study::save (const char *dicom_dir)
     if (d_ptr->img) {
         this->save_image (dicom_dir);
     }
-    if (d_ptr->cxt) {
+    if (d_ptr->rtss) {
         this->save_rtss (dicom_dir);
     }
     if (d_ptr->dose) {
diff --git a/src/plastimatch/base/dcmtk_rt_study_p.h b/src/plastimatch/base/dcmtk_rt_study_p.h
index ba85ccb..4c73b92 100644
--- a/src/plastimatch/base/dcmtk_rt_study_p.h
+++ b/src/plastimatch/base/dcmtk_rt_study_p.h
@@ -30,8 +30,8 @@ public:
     Dcmtk_series *ds_rtdose;
     Dcmtk_series *ds_rtss;
 
-    Rtss::Pointer cxt;
-    Metadata *cxt_metadata;
+    Rtss::Pointer rtss;
+    Metadata *rtss_metadata;
     //Plm_image_set::Pointer img;
     Plm_image::Pointer img;
     Plm_image::Pointer dose;
diff --git a/src/plastimatch/base/dcmtk_rtss.cxx b/src/plastimatch/base/dcmtk_rtss.cxx
index 3231707..648bab5 100755
--- a/src/plastimatch/base/dcmtk_rtss.cxx
+++ b/src/plastimatch/base/dcmtk_rtss.cxx
@@ -63,7 +63,7 @@ void
 Dcmtk_loader::rtss_load (void)
 {
     Dcmtk_series *ds_rtss = d_ptr->ds_rtss;
-    d_ptr->cxt = Rtss::New();
+    d_ptr->rtss = Rtss::New();
 
     /* Modality -- better be RTSTRUCT */
     std::string modality = ds_rtss->get_modality();
@@ -101,7 +101,7 @@ Dcmtk_loader::rtss_load (void)
             val = 0;
             orc = seq->getItem(i)->findAndGetString (DCM_ROIName, val);
             lprintf ("Adding structure (%d), %s\n", structure_id, val);
-            d_ptr->cxt->add_structure (
+            d_ptr->rtss->add_structure (
                 std::string (val), std::string(), structure_id);
         }
     }
@@ -131,7 +131,7 @@ Dcmtk_loader::rtss_load (void)
             lprintf ("Structure %d has color %s\n", structure_id, val);
 
             /* Look up the structure for this id and set color */
-            curr_structure = d_ptr->cxt->find_structure_by_id (structure_id);
+            curr_structure = d_ptr->rtss->find_structure_by_id (structure_id);
             if (!curr_structure) {
                 lprintf ("Couldn't reference structure with id %d\n", 
                     structure_id);
@@ -247,7 +247,7 @@ void
 Dcmtk_rt_study::save_rtss (const char *dicom_dir)
 {
     OFCondition ofc;
-    Rtss::Pointer& cxt = d_ptr->cxt;
+    Rtss::Pointer& rtss = d_ptr->rtss;
     Metadata::Pointer rtss_metadata;
     if (d_ptr->rt_study_metadata) {
         rtss_metadata = d_ptr->rt_study_metadata->get_rtss_metadata ();
@@ -255,7 +255,7 @@ Dcmtk_rt_study::save_rtss (const char *dicom_dir)
 
     /* Prepare structure set with slice uids */
     const Slice_list *slice_list = d_ptr->rt_study_metadata->get_slice_list ();
-    cxt->apply_slice_list (slice_list);
+    rtss->apply_slice_list (slice_list);
 
     /* Prepare dcmtk */
     DcmFileFormat fileformat;
@@ -356,25 +356,25 @@ Dcmtk_rt_study::save_rtss (const char *dicom_dir)
     /* ----------------------------------------------------------------- */
     /*     Part 3  -- Structure info                                     */
     /* ----------------------------------------------------------------- */
-    for (size_t i = 0; i < cxt->num_structures; i++) {
+    for (size_t i = 0; i < rtss->num_structures; i++) {
         DcmItem *ssroi_item = 0;
         std::string tmp;
         dataset->findOrCreateSequenceItem (
             DCM_StructureSetROISequence, ssroi_item, -2);
-        tmp = string_format ("%d", cxt->slist[i]->id);
+        tmp = string_format ("%d", rtss->slist[i]->id);
         ssroi_item->putAndInsertString (DCM_ROINumber, tmp.c_str());
         ssroi_item->putAndInsertString (DCM_ReferencedFrameOfReferenceUID,
             d_ptr->rt_study_metadata->get_frame_of_reference_uid());
         ssroi_item->putAndInsertString (DCM_ROIName, 
-            cxt->slist[i]->name.c_str());
+            rtss->slist[i]->name.c_str());
         ssroi_item->putAndInsertString (DCM_ROIGenerationAlgorithm, "");
     }
 
     /* ----------------------------------------------------------------- */
     /*     Part 4  -- Contour info                                       */
     /* ----------------------------------------------------------------- */
-    for (size_t i = 0; i < cxt->num_structures; i++) {
-	Rtss_roi *curr_structure = cxt->slist[i];
+    for (size_t i = 0; i < rtss->num_structures; i++) {
+	Rtss_roi *curr_structure = rtss->slist[i];
         DcmItem *roic_item = 0;
         dataset->findOrCreateSequenceItem (
             DCM_ROIContourSequence, roic_item, -2);
@@ -443,8 +443,8 @@ Dcmtk_rt_study::save_rtss (const char *dicom_dir)
     /* ----------------------------------------------------------------- */
     /*     Part 5  -- More structure info                                */
     /* ----------------------------------------------------------------- */
-    for (size_t i = 0; i < cxt->num_structures; i++) {
-	Rtss_roi *curr_structure = cxt->slist[i];
+    for (size_t i = 0; i < rtss->num_structures; i++) {
+	Rtss_roi *curr_structure = rtss->slist[i];
         std::string tmp;
 
         /* RTROIObservationsSequence */
diff --git a/src/plastimatch/base/plm_image.cxx b/src/plastimatch/base/plm_image.cxx
index f757ebd..739f95c 100644
--- a/src/plastimatch/base/plm_image.cxx
+++ b/src/plastimatch/base/plm_image.cxx
@@ -110,6 +110,7 @@ void
 Plm_image::free ()
 {
     d_ptr->m_vol.reset ();
+    d_ptr->m_vol_list.clear ();
 
     m_original_type = PLM_IMG_TYPE_UNDEFINED;
     m_type = PLM_IMG_TYPE_UNDEFINED;
diff --git a/src/plastimatch/base/rpl_volume.cxx b/src/plastimatch/base/rpl_volume.cxx
index 4db8d69..53ef056 100644
--- a/src/plastimatch/base/rpl_volume.cxx
+++ b/src/plastimatch/base/rpl_volume.cxx
@@ -2142,7 +2142,7 @@ Rpl_volume::compute_beam_modifiers_core (Volume *seg_vol, bool active, float sme
 
     Volume::Pointer aperture_vol = d_ptr->aperture->get_aperture_volume ();
     unsigned char *aperture_img = (unsigned char*) aperture_vol->img;
-    for (int i = 0; i < aperture_vol->dim[0] * aperture_vol->dim[0]; i++)
+    for (int i = 0; i < aperture_vol->dim[0] * aperture_vol->dim[1]; i++)
     {
         if (map_wed_min[i] > 0) {
             aperture_img[i] = 1;
@@ -2256,7 +2256,7 @@ Rpl_volume::compute_beam_modifiers_core_slicerRt (Plm_image::Pointer& plmTgt, bo
 
     Volume::Pointer aperture_vol = d_ptr->aperture->get_aperture_volume ();
     unsigned char *aperture_img = (unsigned char*) aperture_vol->img;
-    for (int i = 0; i < aperture_vol->dim[0] * aperture_vol->dim[0]; i++)
+    for (int i = 0; i < aperture_vol->dim[0] * aperture_vol->dim[1]; i++)
     {
         if (map_wed_min[i] > 0) {
             aperture_img[i] = 1;
diff --git a/src/plastimatch/base/rtss.cxx b/src/plastimatch/base/rtss.cxx
index 0dfd076..5ce44ac 100644
--- a/src/plastimatch/base/rtss.cxx
+++ b/src/plastimatch/base/rtss.cxx
@@ -468,7 +468,7 @@ Rtss::set_rasterization_geometry (void)
 }
 
 void
-Rtss::apply_slice_index (const Rt_study_metadata::Pointer& rsm)
+Rtss::apply_slice_list (const Rt_study_metadata::Pointer& rsm)
 {
     this->apply_slice_list (rsm->get_slice_list());
 }
diff --git a/src/plastimatch/base/rtss.h b/src/plastimatch/base/rtss.h
index dab075b..380cc42 100644
--- a/src/plastimatch/base/rtss.h
+++ b/src/plastimatch/base/rtss.h
@@ -18,6 +18,10 @@ class Plm_image_header;
 class Rtss_roi;
 class Slice_list;
 
+/*! \brief 
+ * The Rtss class represents a set of segmentations in polyline format, 
+ * analogous to the DICOM-RT RTSTRUCT object.
+ */
 class PLMBASE_API Rtss {
 public:
     SMART_POINTER_SUPPORT (Rtss);
@@ -59,7 +63,9 @@ public:
     void find_rasterization_geometry (Plm_image_header *pih);
     std::string find_unused_structure_name (void);
     void fix_polyline_slice_numbers (void);
-    void apply_slice_index (const Rt_study_metadata::Pointer& rsm);
+    /*! \brief Copy slice UIDs from referenced image into the Rtss object. */
+    void apply_slice_list (const Rt_study_metadata::Pointer& rsm);
+    /*! \brief Copy slice UIDs from referenced image into the Rtss object. */
     void apply_slice_list (const Slice_list *slice_list);
     void free_all_polylines (void);
     void keyholize (void);
diff --git a/src/plastimatch/base/segmentation.cxx b/src/plastimatch/base/segmentation.cxx
index 4258513..c906e69 100644
--- a/src/plastimatch/base/segmentation.cxx
+++ b/src/plastimatch/base/segmentation.cxx
@@ -599,7 +599,7 @@ Segmentation::apply_dicom_dir (const Rt_study_metadata::Pointer& rsm)
         return;
     }
 
-    d_ptr->m_rtss->apply_slice_index (rsm);
+    d_ptr->m_rtss->apply_slice_list (rsm);
 }
 
 void
diff --git a/src/plastimatch/base/slice_list.cxx b/src/plastimatch/base/slice_list.cxx
index 7f2f314..d1ee3ce 100755
--- a/src/plastimatch/base/slice_list.cxx
+++ b/src/plastimatch/base/slice_list.cxx
@@ -2,6 +2,8 @@
    See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
    ----------------------------------------------------------------------- */
 #include "plmbase_config.h"
+#include <list>
+#include <deque>
 #include <vector>
 #include <stdio.h>
 #include <stdlib.h>
@@ -13,14 +15,32 @@
 #include "print_and_exit.h"
 #include "slice_list.h"
 
+class Slice_data {
+public:
+    Slice_data () : z(0.f), uid("") { }
+public:
+    float z;
+    std::string uid;
+};
+
+class Slice_group {
+public:
+    Plm_image_header group_pih;
+    /* Slices are sorted in order, starting with origin slice */
+    std::list<Slice_data> slice_data;
+};
+
 class Slice_list_private {
 public:
     bool m_have_pih;
     bool m_have_slice_uids;
     Plm_image_header m_pih;
 
-    /* These must be sorted in order, starting with origin slice */
-    std::vector<std::string> m_ct_slice_uids;
+    // Sorted slices in "ascending z order", starting with origin slice
+    std::vector<Slice_data> sorted_slices;
+    // Slice groups are also sorted in the same order
+    std::list<Slice_group> slice_groups;
+
 public:
     Slice_list_private () {
         this->m_have_pih = false;
@@ -48,7 +68,7 @@ void
 Slice_list::set_image_header (const Plm_image_header& pih)
 {
     d_ptr->m_pih = pih;
-    d_ptr->m_ct_slice_uids.resize (pih.dim(2));
+    d_ptr->sorted_slices.resize (pih.dim(2));
     d_ptr->m_have_pih = true;
 }
 
@@ -65,31 +85,31 @@ Slice_list::get_slice_uid (int index) const
     if (!d_ptr->m_have_slice_uids) {
 	return "";
     }
-    if (index < 0 || ((size_t) index) >= d_ptr->m_ct_slice_uids.size()) {
+    if (index < 0 || ((size_t) index) >= d_ptr->sorted_slices.size()) {
 	return "";
     }
-    return d_ptr->m_ct_slice_uids[index].c_str();
+    return d_ptr->sorted_slices[index].uid.c_str();
 }
 
 void
 Slice_list::reset_slice_uids ()
 {
-    d_ptr->m_ct_slice_uids.clear();
+    d_ptr->sorted_slices.clear();
     if (d_ptr->m_have_pih) {
-        d_ptr->m_ct_slice_uids.resize (d_ptr->m_pih.dim(2));
+        d_ptr->sorted_slices.resize (d_ptr->m_pih.dim(2));
     }
 }
 
 void
 Slice_list::set_slice_uid (int index, const char* slice_uid)
 {
-    if (index >= (int) d_ptr->m_ct_slice_uids.size()) {
+    if (index >= (int) d_ptr->sorted_slices.size()) {
         print_and_exit (
             "Illegal call to Slice_list::set_slice_uid.  "
             "Index %d > Size %d.\n", 
-            index, d_ptr->m_ct_slice_uids.size());
+            index, d_ptr->sorted_slices.size());
     }
-    d_ptr->m_ct_slice_uids[index] = std::string (slice_uid);
+    d_ptr->sorted_slices[index].uid = std::string (slice_uid);
 }
 
 bool
diff --git a/src/plastimatch/dose/wed_parms.cxx b/src/plastimatch/dose/wed_parms.cxx
index 39a13a2..73b4106 100644
--- a/src/plastimatch/dose/wed_parms.cxx
+++ b/src/plastimatch/dose/wed_parms.cxx
@@ -161,7 +161,8 @@ Wed_Parms::set_key_val (
         /* [INPUT SETTINGS] */
     case 0:
         //Whether wed or reverse, input patient and rpl vol
-        if (!strcmp (key, "ct")) {
+        /* patient is legacy term */
+        if (!strcmp (key, "ct") || !strcmp (key, "patient")) {
             this->input_ct_fn = val;
         }
         else if (!strcmp (key, "proj_wed")) {
@@ -176,7 +177,7 @@ Wed_Parms::set_key_val (
             this->input_dose_fn = val;
         }
         //If reverse wed procedure, input dose_wed
-        else if (!strcmp (key, "wed_dose")) {
+        else if (!strcmp (key, "wed_dose") || !strcmp (key, "dose_wed")) {
             this->input_wed_dose_fn = val;
         }
         //If in depth/segmentation mode, input segment
@@ -196,10 +197,12 @@ Wed_Parms::set_key_val (
         else if (!strcmp (key, "proj_dose")) {
             this->output_proj_dose_fn = val;
         }
-        else if (!strcmp (key, "wed_ct")) {
+        /* patient_wed is legacy term */
+        else if (!strcmp (key, "wed_ct") || !strcmp (key, "patient_wed")) {
             this->output_wed_ct_fn = val;
         }
-        else if (!strcmp (key, "wed_dose")) {
+        /* dose_wed is legacy term */
+        else if (!strcmp (key, "wed_dose") || !strcmp (key, "dose_wed")) {
             this->output_wed_dose_fn = val;
         }
         else if (!strcmp (key, "ct")) {
@@ -208,7 +211,8 @@ Wed_Parms::set_key_val (
         else if (!strcmp (key, "dew_ct")) {
             this->output_dew_ct_fn = val;
         }
-        else if (!strcmp (key, "dew_dose")) {
+        /* dose is legacy term */
+        else if (!strcmp (key, "dew_dose") || !strcmp (key, "dose")) {
             this->output_dew_dose_fn = val;
         }
 #if defined (commentout)
diff --git a/src/plastimatch/plastimatch_version.txt b/src/plastimatch/plastimatch_version.txt
deleted file mode 100644
index a924a6c..0000000
--- a/src/plastimatch/plastimatch_version.txt
+++ /dev/null
@@ -1 +0,0 @@
-1.6.3 (5341)
\ No newline at end of file
diff --git a/src/plastimatch/register/bspline.cxx b/src/plastimatch/register/bspline.cxx
index de644ee..4a52dab 100644
--- a/src/plastimatch/register/bspline.cxx
+++ b/src/plastimatch/register/bspline.cxx
@@ -361,40 +361,45 @@ report_score (
         "NV %6d GM %9.3f GN %9.3g [ %9.3f s ]\n",
         ssd->num_vox, ssd_grad_mean, sqrt (ssd_grad_norm), total_time);
     
-    /* Second line - smetric(s) */
-    if (ssd->smetric.size() > 1) {
+    /* Second line */
+    if (reg_parms->lambda > 0 || blm->num_landmarks > 0
+        || parms->metric_type.size() > 1)
+    {
+        logfile_printf ("         ");
+        /* Part 1 - smetric(s) */   
         std::vector<float>::const_iterator it_sm = ssd->smetric.begin();
         std::vector<Registration_metric_type>::const_iterator it_st
             = parms->metric_type.begin();
-        logfile_printf ("         ");
         while (it_sm != ssd->smetric.end()) {
             logfile_printf ("%-6s",
                 registration_metric_type_string (*it_st));
             logfile_print_score (*it_sm);
             ++it_sm, ++it_st;
         }
-        logfile_printf ("\n");
-    }
-    
-    /* Second line - extra stats if regularization is enabled */
-    if (reg_parms->lambda > 0 || blm->num_landmarks > 0) {
-        /* Part 2 - regularization metric */
-        if (reg_parms->lambda > 0) {
-            logfile_printf ("RM %9.3f ", 
-                reg_parms->lambda * bst->ssd.rmetric);
-        }
-        /* Part 3 - landmark metric */
-        if (blm->num_landmarks > 0) {
-            logfile_printf ("LM %9.3f ", 
-                blm->landmark_stiffness * bst->ssd.lmetric);
-        }
-        /* Part 4 - timing */
-        if (reg_parms->lambda > 0) {
-            logfile_printf ("[ %9.3f | %9.3f ]\n", 
-                ssd->time_smetric[0], ssd->time_rmetric);
-        } else {
+        if (ssd->smetric.size() > 1
+            && (reg_parms->lambda > 0 || blm->num_landmarks > 0))
+        {
             logfile_printf ("\n");
+            logfile_printf ("         ");
         }
+        if (reg_parms->lambda > 0 || blm->num_landmarks > 0) {
+            /* Part 2 - regularization metric */
+            if (reg_parms->lambda > 0) {
+                logfile_printf ("RM %9.3f ", 
+                    reg_parms->lambda * bst->ssd.rmetric);
+            }
+            /* Part 3 - landmark metric */
+            if (blm->num_landmarks > 0) {
+                logfile_printf ("LM %9.3f ", 
+                    blm->landmark_stiffness * bst->ssd.lmetric);
+            }
+            /* Part 4 - timing */
+            if (reg_parms->lambda > 0) {
+                logfile_printf ("[ %9.3f | %9.3f ]", 
+                    ssd->time_smetric[0], ssd->time_rmetric);
+            }
+        }
+        logfile_printf ("\n");
     }
 }
 
diff --git a/src/plastimatch/register/bspline_optimize_lbfgsb.cxx b/src/plastimatch/register/bspline_optimize_lbfgsb.cxx
index 16d060b..c48753f 100644
--- a/src/plastimatch/register/bspline_optimize_lbfgsb.cxx
+++ b/src/plastimatch/register/bspline_optimize_lbfgsb.cxx
@@ -52,12 +52,11 @@ Nocedal_optimizer::Nocedal_optimizer (Bspline_optimize *bod)
     Bspline_xform *bxf = bod->get_bspline_xform ();
 
     int nmax = bxf->num_coeff;
-    int mmax = 20;
+    int mmax = parms->lbfgsb_mmax;
 
-    /* Try to allocate memory for hessian approximation.  
-       First guess based on heuristic. */
-    if (bxf->num_coeff >= 20) {
-        mmax = 20 + (int) floor (sqrt ((float) (bxf->num_coeff - 20)));
+    /* Automatic memory sizing for hessian approximation based on heuristic */
+    if (parms->lbfgsb_mmax < 1) {
+        mmax = 2 + (int) floor (sqrt ((float) (bxf->num_coeff)));
         if (mmax > std::numeric_limits<int>::max() / nmax / 10) {
             mmax = std::numeric_limits<int>::max() / nmax / 10;
         }
@@ -65,6 +64,11 @@ Nocedal_optimizer::Nocedal_optimizer (Bspline_optimize *bod)
             mmax = 500;
         }
     }
+    /* Matrix is never bigger than square */
+    if (mmax > nmax) {
+        mmax = nmax;
+    }
+    /* Check that we have enough memory for the requested mmax */
     do {
         nbd = (integer*) malloc (sizeof(integer)*nmax);
         iwa = (integer*) malloc (sizeof(integer)*3*nmax);
diff --git a/src/plastimatch/register/bspline_parms.cxx b/src/plastimatch/register/bspline_parms.cxx
index 487b5ce..46cf12b 100644
--- a/src/plastimatch/register/bspline_parms.cxx
+++ b/src/plastimatch/register/bspline_parms.cxx
@@ -34,6 +34,7 @@ Bspline_parms::Bspline_parms ()
 
     this->lbfgsb_factr = 1.0e+7;
     this->lbfgsb_pgtol = 1.0e-5;
+    this->lbfgsb_mmax = -1;
 
     this->fixed = 0;
     this->moving = 0;
diff --git a/src/plastimatch/register/bspline_parms.h b/src/plastimatch/register/bspline_parms.h
index 6e27fad..6fee4be 100644
--- a/src/plastimatch/register/bspline_parms.h
+++ b/src/plastimatch/register/bspline_parms.h
@@ -64,6 +64,7 @@ public:
     /* LBFGSB optimizer parms */
     double_align8 lbfgsb_factr;  /* Function value tolerance for L-BFGS-B */
     double_align8 lbfgsb_pgtol;  /* Projected grad tolerance for L-BFGS-B */
+    int lbfgsb_mmax;             /* Number of rows in M matrix */
 
     /* Image Volumes - these are not owned by Bspline_parms */
     Volume* fixed;
diff --git a/src/plastimatch/register/bspline_stage.cxx b/src/plastimatch/register/bspline_stage.cxx
index 94a3684..9fa08e6 100644
--- a/src/plastimatch/register/bspline_stage.cxx
+++ b/src/plastimatch/register/bspline_stage.cxx
@@ -258,6 +258,7 @@ Bspline_stage::initialize ()
         bsp_parms->optimization = BOPT_LBFGSB;
     }
     bsp_parms->lbfgsb_pgtol = stage->pgtol;
+    bsp_parms->lbfgsb_mmax = stage->lbfgsb_mmax;
 
     /* Metric */
     bsp_parms->metric_type = stage->metric_type;
@@ -298,6 +299,7 @@ Bspline_stage::initialize ()
         print_and_exit ("Undefined impl type in gpuit_bspline\n");
     }
     logfile_printf ("Algorithm flavor = %c\n", bsp_parms->implementation);
+    logfile_printf ("Threading = %d\n", bsp_parms->threading);
 
     if (stage->threading_type == THREADING_CUDA) {
         bsp_parms->gpuid = stage->gpuid;
diff --git a/src/plastimatch/register/bspline_state.cxx b/src/plastimatch/register/bspline_state.cxx
index 7f1fb80..2071e7f 100644
--- a/src/plastimatch/register/bspline_state.cxx
+++ b/src/plastimatch/register/bspline_state.cxx
@@ -150,6 +150,10 @@ bspline_cuda_state_create (
 )
 {
 #if (CUDA_FOUND)
+    if (parms->threading != BTHR_CUDA) {
+        return;
+    }
+
     /* Set the gpuid */
     LOAD_LIBRARY_SAFE (libplmcuda);
     LOAD_SYMBOL (CUDA_selectgpu, libplmcuda);
@@ -164,7 +168,7 @@ bspline_cuda_state_create (
         = (Dev_Pointers_Bspline*) malloc (sizeof (Dev_Pointers_Bspline));
     bst->dev_ptrs = dev_ptrs;
     
-    if ((parms->threading == BTHR_CUDA) && (parms->metric_type[0] == REGISTRATION_METRIC_MSE)) {
+    if (parms->metric_type[0] == REGISTRATION_METRIC_MSE) {
         /* Be sure we loaded the CUDA plugin */
         LOAD_LIBRARY_SAFE (libplmregistercuda);
         LOAD_SYMBOL (CUDA_bspline_mse_init_j, libplmregistercuda);
@@ -183,8 +187,7 @@ bspline_cuda_state_create (
 
         UNLOAD_LIBRARY (libplmregistercuda);
     } 
-    else if ((parms->threading == BTHR_CUDA) && (parms->metric_type[0] == REGISTRATION_METRIC_MI_MATTES)) {
-
+    else if (parms->metric_type[0] == REGISTRATION_METRIC_MI_MATTES) {
         /* Be sure we loaded the CUDA plugin */
         LOAD_LIBRARY_SAFE (libplmregistercuda);
         LOAD_SYMBOL (CUDA_bspline_mi_init_a, libplmregistercuda);
@@ -216,17 +219,21 @@ bspline_cuda_state_destroy (
 )
 {
 #if (CUDA_FOUND)
+    if (parms->threading != BTHR_CUDA) {
+        return;
+    }
+
     Volume *fixed = parms->fixed;
     Volume *moving = parms->moving;
     Volume *moving_grad = parms->moving_grad;
 
-    if ((parms->threading == BTHR_CUDA) && (parms->metric_type[0] == REGISTRATION_METRIC_MSE)) {
+    if (parms->metric_type[0] == REGISTRATION_METRIC_MSE) {
         LOAD_LIBRARY_SAFE (libplmregistercuda);
         LOAD_SYMBOL (CUDA_bspline_mse_cleanup_j, libplmregistercuda);
         CUDA_bspline_mse_cleanup_j ((Dev_Pointers_Bspline *) bst->dev_ptrs, fixed, moving, moving_grad);
         UNLOAD_LIBRARY (libplmregistercuda);
     }
-    else if ((parms->threading == BTHR_CUDA) && (parms->metric_type[0] == REGISTRATION_METRIC_MI_MATTES)) {
+    else if (parms->metric_type[0] == REGISTRATION_METRIC_MI_MATTES) {
         LOAD_LIBRARY_SAFE (libplmregistercuda);
         LOAD_SYMBOL (CUDA_bspline_mi_cleanup_a, libplmregistercuda);
         CUDA_bspline_mi_cleanup_a ((Dev_Pointers_Bspline *) bst->dev_ptrs, fixed, moving, moving_grad);
diff --git a/src/plastimatch/register/registration_parms.cxx b/src/plastimatch/register/registration_parms.cxx
index 96463ca..62b974b 100644
--- a/src/plastimatch/register/registration_parms.cxx
+++ b/src/plastimatch/register/registration_parms.cxx
@@ -651,6 +651,12 @@ Registration_parms::set_key_value (
             goto error_exit;
         }
     }
+    else if (key == "lbfgsb_mmax") {
+        if (!section_stage) goto key_only_allowed_in_section_stage;
+        if (sscanf (val.c_str(), "%d", &stage->lbfgsb_mmax) != 1) {
+            goto error_exit;
+        }
+    }
     else if (key == "max_step") {
         if (!section_stage) goto key_only_allowed_in_section_stage;
         if (sscanf (val.c_str(), "%g", &stage->max_step) != 1) {
diff --git a/src/plastimatch/register/stage_parms.cxx b/src/plastimatch/register/stage_parms.cxx
index 357876c..68e5a29 100644
--- a/src/plastimatch/register/stage_parms.cxx
+++ b/src/plastimatch/register/stage_parms.cxx
@@ -74,6 +74,7 @@ Stage_parms::Stage_parms ()
     grad_tol = 1.5;
     /* LBGFGB optimizer */
     pgtol = 1.0e-5;
+    lbfgsb_mmax = -1;
     /* Versor & RSG optimizer */
     max_step = 1.00;
     min_step = 0.001;
@@ -194,6 +195,7 @@ Stage_parms::Stage_parms (const Stage_parms& s)
     grad_tol = s.grad_tol;
     /* LBGFGB optimizer */
     pgtol = s.pgtol;
+    lbfgsb_mmax = s.lbfgsb_mmax;
     /* Versor & RSG optimizer */
     max_step = s.max_step;
     min_step = s.min_step;
diff --git a/src/plastimatch/register/stage_parms.h b/src/plastimatch/register/stage_parms.h
index a74d6b1..80be1ec 100644
--- a/src/plastimatch/register/stage_parms.h
+++ b/src/plastimatch/register/stage_parms.h
@@ -150,6 +150,7 @@ public:
     float grad_tol;
     /* LBGFGB optimizer */
     float pgtol;
+    int lbfgsb_mmax;
     /* Versor & RSG optimizer */
     float max_step;
     float min_step;
diff --git a/src/plastimatch/standalone/wed_main.cxx b/src/plastimatch/standalone/wed_main.cxx
index 099d0b0..bd62b07 100644
--- a/src/plastimatch/standalone/wed_main.cxx
+++ b/src/plastimatch/standalone/wed_main.cxx
@@ -297,6 +297,15 @@ do_wed (Wed_Parms *parms)
         proj_wed->load_rpl (parms->input_proj_wed_fn);
     }
 
+    /* Load the input wed_dose */
+    Plm_image::Pointer wed_dose;
+    if (parms->input_wed_dose_fn != "") {
+        printf("Loading input wed_dose: %s\n",parms->input_wed_dose_fn.c_str());
+        wed_dose = plm_image_load (parms->input_wed_dose_fn.c_str(), 
+            PLM_IMG_TYPE_ITK_FLOAT);
+    }
+
+    /* Load the skin */
     if (parms->input_skin_fn != "") {
         printf ("Skin file defined.  Modifying input ct...\n");
  
@@ -313,6 +322,7 @@ do_wed (Wed_Parms *parms)
         }
     }
   
+    /* Set up the beam */
     Aperture::Pointer aperture = Aperture::New();
     aperture->set_distance (parms->ap_offset);
     aperture->set_spacing (parms->ap_spacing);
@@ -369,8 +379,18 @@ do_wed (Wed_Parms *parms)
         Plm_image(dew_vol).save_image(parms->output_dew_ct_fn);
     }
 
+    if (parms->output_dew_dose_fn != "") {
+        if (!wed_dose) {
+            print_and_exit ("Error, dew_dose requested but no wed_dose supplied.\n");
+        }
+        Volume* dew_vol = create_dew_volume (parms, wed_dose->get_volume_float());
+        rpl.compute_dew_volume (wed_dose->get_volume_float().get(), 
+            dew_vol, 0);
+        Plm_image(dew_vol).save_image(parms->output_dew_dose_fn);
+    }
+
     if (parms->output_wed_ct_fn != "") {
-        printf ("Computing patient wed volume...\n");
+        printf ("Computing wed ct volume...\n");
 	Volume *wed_vol = create_wed_volume (parms, &rpl);
         rpl.compute_wed_volume (wed_vol, ct_vol->get_volume_float().get(), 
             background[0]);
@@ -378,11 +398,21 @@ do_wed (Wed_Parms *parms)
         printf ("done.\n");
     }
 
+    if (parms->output_wed_dose_fn != "") {
+        printf ("Computing wed dose volume...\n");
+	Volume *wed_vol = create_wed_volume (parms, &rpl);
+        rpl.compute_wed_volume (wed_vol, dose_vol->get_volume_float().get(), 
+            background[1]);
+        Plm_image(wed_vol).save_image(parms->output_wed_dose_fn);
+        printf ("done.\n");
+    }
+
     /* Compute the proj_ct volume */
     if (parms->output_proj_ct_fn != "") {
         rpl.compute_rpl_HU ();
         rpl.save (parms->output_proj_ct_fn);
     }
+
 }
 
 int
diff --git a/src/plastimatch/standalone/xvi_archive.cxx b/src/plastimatch/standalone/xvi_archive.cxx
index 895c1bd..369e996 100644
--- a/src/plastimatch/standalone/xvi_archive.cxx
+++ b/src/plastimatch/standalone/xvi_archive.cxx
@@ -340,6 +340,11 @@ do_xvi_archive (Xvi_archive_parms *parms)
             xfp[10] = - (xfp[3]*xvip[12] + xfp[4]*xvip[13] + xfp[5]*xvip[14]);
             xfp[11] = - (xfp[6]*xvip[12] + xfp[7]*xvip[13] + xfp[8]*xvip[14]);
         
+            // "C", Possible
+            xfp[9]  = - (xfp[0]*xvip[12] + xfp[1]*xvip[13] + xfp[2]*xvip[14]);
+            xfp[10] = - (xfp[3]*xvip[12] + xfp[4]*xvip[13] + xfp[5]*xvip[14]);
+            xfp[11] = - (xfp[6]*xvip[12] + xfp[7]*xvip[13] + xfp[8]*xvip[14]);
+        
         }
         else if (patient_position == "FFP") {
             xfp[0] = - xvip[8];
diff --git a/src/plastimatch/sys/plm_config.h.in b/src/plastimatch/sys/plm_config.h.in
index 57ee42b..fb9d9b0 100644
--- a/src/plastimatch/sys/plm_config.h.in
+++ b/src/plastimatch/sys/plm_config.h.in
@@ -28,13 +28,6 @@
 #define CMAKE_SIZEOF_SIZE_T @CMAKE_SIZEOF_SIZE_T@
 #define PLM_BIG_ENDIAN @PLM_BIG_ENDIAN@
 
-/* Plastimatch version attributes */
-#cmakedefine PLASTIMATCH_HAVE_BUILD_NUMBER 1
-#define PLASTIMATCH_BUILD_NUMBER "@PLASTIMATCH_SVN_VERSION@"
-#cmakedefine PLM_DEFAULT_VERSION_STRING "@PLM_DEFAULT_VERSION_STRING@"
-#cmakedefine PLM_RELEASE_VERSION_STRING "@PLM_RELEASE_VERSION_STRING@"
-#cmakedefine PLM_CONFIG_VERSION_STRING "@PLM_CONFIG_VERSION_STRING@"
-
 /* External libraries */
 #cmakedefine CUDA_FOUND 1
 #cmakedefine DCMTK_FOUND 1
diff --git a/src/plastimatch/sys/plm_version.h b/src/plastimatch/sys/plm_version.h
deleted file mode 100644
index 6f7c540..0000000
--- a/src/plastimatch/sys/plm_version.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -----------------------------------------------------------------------
-   See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
-   ----------------------------------------------------------------------- */
-#ifndef _plm_version_h_
-#define _plm_version_h_
-
-#include "plmsys_config.h"
-
-#if defined (PLM_RELEASE_VERSION_STRING)
-  #define PLASTIMATCH_VERSION PLM_RELEASE_VERSION_STRING
-#elif defined (PLM_CONFIG_VERSION_STRING)
-  #define PLASTIMATCH_VERSION PLM_CONFIG_VERSION_STRING
-#else
-  #define PLASTIMATCH_VERSION PLM_DEFAULT_VERSION_STRING "-beta"
-#endif
-
-#if (PLASTIMATCH_HAVE_BUILD_NUMBER)
-  #define PLASTIMATCH_VERSION_STRING  PLASTIMATCH_VERSION " (" PLASTIMATCH_BUILD_NUMBER ")"
-#else
-  #define PLASTIMATCH_VERSION_STRING  PLASTIMATCH_VERSION
-#endif
-
-#endif
diff --git a/src/plastimatch/sys/plm_version.h.in b/src/plastimatch/sys/plm_version.h.in
new file mode 100644
index 0000000..3fc1f90
--- /dev/null
+++ b/src/plastimatch/sys/plm_version.h.in
@@ -0,0 +1,9 @@
+/* -----------------------------------------------------------------------
+   See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
+   ----------------------------------------------------------------------- */
+#ifndef _plm_version_h_
+#define _plm_version_h_
+
+#define PLASTIMATCH_VERSION_STRING "@PLASTIMATCH_VERSION_STRING@"
+
+#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/plastimatch.git



More information about the debian-med-commit mailing list