Skip to content

Commit

Permalink
Merge pull request #9 from rg2/devel
Browse files Browse the repository at this point in the history
Latest changes from devel branch - preparing for next release.
  • Loading branch information
rg2 committed Sep 20, 2021
2 parents 066b678 + 5864a11 commit c06440d
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
#endif ()

# Version format is YYYY.MM.DD for a release and YYYY.MM.DD.1 for devel after the release
project(xreg VERSION 2020.12.13.1)
project(xreg VERSION 2021.09.19.0)

set (CMAKE_CXX_STANDARD "11" CACHE STRING "C++ Standard (needs at least 11)")
mark_as_advanced(CMAKE_CXX_STANDARD)
Expand Down
4 changes: 2 additions & 2 deletions dist/dist_readme/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
| xReg: Modeling and Registration Software for Surgery |
| |
| Executable Programs |
| v2020.12.13.0 |
| v2021.09.19.0 |
| |
| Robert Grupp ([email protected]) |
+------------------------------------------------------+
Expand All @@ -17,7 +17,7 @@ See the following pages for more information about the library and tools:
The walkthrough link above contains demonstrations (with data) on example usages of these tools.

Included in this release is a "bin" directory which contains the xReg executable files. Each xReg
program name is prefixed with "xreg-" (e.g. "xreg-convert-dicom"). The help message of each
program name is prefixed with "xreg-" (e.g. "xreg-convert-dicom-vols"). The help message of each
program, obtained by passing the "--help" or "-h" flags, documents the program's interface and
the available options.

Expand Down
10 changes: 7 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
## Introduction
The files in this directory may be used to create Docker images with builds of the xReg software.
Ubuntu and CentOS base images are supported.
The releases of exectuable programs for CentOS 7 and Ubuntu 16.04 were created using this pipeline.
The releases of exectuable programs for CentOS 7 and Ubuntu 16.04, 18.04, 20.04 were created using this pipeline.

The build argument `os_name` is used to choose either Ubuntu or CentOS (e.g. passing `--build-arg os_name=ubuntu` or `--build-arg os_name=centos` to `docker build`).
The operating system version is specified using the `os_version` build argument (e.g. passing `--build-arg os_version=7` or `--build-arg os_version=16.04` to `docker build`).
When these arguments are not provided, Ubuntu 16.04 is used by default.

## GitHub Packages
The images containing all xReg dependencies are available as GitHub packages [here](https://github.com/rg2?tab=packages&repo_name=xreg).
Although these are primarily intended to be used as part of a continuous integration pipeline, others may find them useful for developing or building xReg.
More images may be made available as needed/requested.

## List of Files
* `Dockerfile.centos_dev_base`
* Installs packages needed for xReg build on *CentOS* and also builds a recent version of CMake
Expand All @@ -26,8 +31,7 @@ A copy/pastable list of shell commands is provided in [`example_commands`](examp

Specific commands are also listed below:

NOTE: all of these commands assume that the xReg repository contents are located in ~/xreg-git.
These commands were tested on MacOS 10.14.6 with Docker Desktop (community) 2.3.0.5.
NOTE: all of these commands assume that the xReg repository contents are located in `~/xreg-git`.

### Ubuntu 16.04 Build

Expand Down
1 change: 0 additions & 1 deletion docker/example_commands
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ docker build -t xreg-deps-${OS_NAME}-${OS_VERSION} --build-arg os_name=${OS_NAME

# Build xReg
docker build -t xreg-${OS_NAME}-${OS_VERSION} --build-arg os_name=${OS_NAME} --build-arg os_version=${OS_VERSION} -f ~/xreg-git/docker/Dockerfile.xreg ~/xreg-git
i

# Create xReg distributable
docker build -t xreg-dist-${OS_NAME}-${OS_VERSION} --build-arg os_name=${OS_NAME} --build-arg os_version=${OS_VERSION} -f ~/xreg-git/docker/Dockerfile.xreg-dist-bin ~/xreg-git
Expand Down
75 changes: 69 additions & 6 deletions tests/wiki_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,26 @@ def macos_check_for_dyld_vars():
time.sleep(5)

if __name__ == '__main__':
mac_slicer_default_path = '/Applications/Slicer.app/Contents/MacOS/Slicer'
win_slicer_default_path = 'C:\\Program Files\\Slicer 4.10.2\\Slicer.exe'
linux_slicer_default_path = '$HOME/Slicer-4.10.2-linux-amd64/Slicer'

if ('--help' in sys.argv) or ('-h' in sys.argv):
print('TODO: help message')
print('This script exists for semi-automatic functional testing by executing the commands '
'found on the xReg wiki walkthrough and having the user manually verify the outputs.\n'
'Usage: python {} [<xReg bin directory>]\n'
'xReg binaries will be found via the PATH environment variable when an xReg bin '
'directory is not provided.\n'
'When available on the system, 3D Slicer is automatically invoked to visualize volumes.'
'Depending on the operating system, 3D Slicer is assumed to reside in one of the '
'following locations:\n'
' * MacOS: {}\n'
' * Windows: {}\n'
' * Linux: {}'.format(
os.path.basename(sys.argv[0]),
mac_slicer_default_path,
win_slicer_default_path,
linux_slicer_default_path))
sys.exit(0)
elif len(sys.argv) > 1:
xreg_bin_dir = sys.argv[1]
Expand All @@ -155,18 +173,14 @@ def macos_check_for_dyld_vars():
slicer_path = None

if platform.system() == 'Darwin':
mac_slicer_default_path = '/Applications/Slicer.app/Contents/MacOS/Slicer'

if os.path.exists(mac_slicer_default_path):
slicer_path = mac_slicer_default_path
elif platform.system() == 'Windows':
win_slicer_default_path = 'C:\\Program Files\\Slicer 4.10.2\\Slicer.exe'

if os.path.exists(win_slicer_default_path):
# enclose the path in quotes to handle any spaces
slicer_path = '\"{}\"'.format(win_slicer_default_path)
elif platform.system() == 'Linux':
linux_slicer_default_path = os.path.expandvars('$HOME/Slicer-4.10.2-linux-amd64/Slicer')
linux_slicer_default_path = os.path.expandvars(linux_slicer_default_path)

if os.path.exists(linux_slicer_default_path):
slicer_path = linux_slicer_default_path
Expand Down Expand Up @@ -354,3 +368,52 @@ def macos_check_for_dyld_vars():
view_movie('edges.mp4')
view_movie('mov.mp4')

#################################################################
# Based off: https://github.com/rg2/xreg/wiki/Example%3A-TCIA-Hip-Radiograph-Rigid-Registration
if True:
print('Workflow for 2D/3D registration to real pelvis radiograph...')

print('3D DICOM conversion/resampling...')

download_file('https://services.cancerimagingarchive.net/services/v4/TCIA/query/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.1706.4016.124291161306415775701317569638', 'TCGA-G2-A3VY_ct.zip', True)

extract_zip('TCGA-G2-A3VY_ct.zip', 'TCGA-G2-A3VY_ct_dcm')

run_cmd('xreg-convert-dicom-vols --one TCGA-G2-A3VY_ct_dcm TCGA-G2-A3VY_ct.nii.gz')

view_vol('TCGA-G2-A3VY_ct.nii.gz', slicer_path)

download_file('https://raw.githubusercontent.com/wiki/rg2/xreg/examples/tcia_hip_radiograph_rigid_2d_3d/TCGA-G2-A3VY_ct_full_pelvis-label.nii.gz', use_existing=True)

download_file('https://github.com/rg2/xreg/wiki/examples/tcia_hip_radiograph_rigid_2d_3d/pelvis_3d_lands.fcsv', use_existing=True)

print('Creating 3D mesh of pelvis...')
run_cmd('xreg-create-mesh TCGA-G2-A3VY_ct_full_pelvis-label.nii.gz pelvis.ply 1 2')

print('2D DICOM conversion...')

download_file('https://services.cancerimagingarchive.net/services/v4/TCIA/query/getImage?SeriesInstanceUID=1.3.6.1.4.1.14519.5.2.1.1706.4016.146872675804132000774592060313', 'TCGA-G2-A3VY_radiographs_1.zip', True)

extract_zip('TCGA-G2-A3VY_radiographs_1.zip', 'TCGA-G2-A3VY_radiographs')

download_file('https://github.com/rg2/xreg/wiki/examples/tcia_hip_radiograph_rigid_2d_3d/2-c73e.fcsv', use_existing=True)

run_cmd('xreg-convert-dicom-radiograph TCGA-G2-A3VY_radiographs/2-c73e4bdf6c7d19772d00acd2891965fa.dcm 2-c73e_pd.h5 2-c73e.fcsv')

run_cmd('xreg-remap-tile-proj-data -d 0.25 -o 2-c73e_pd.h5 2-c73e_remap.png')

view_image('2-c73e_remap.png')

run_cmd('xreg-draw-xray-scene -i -l 2-c73e_pd.h5 pelvis.ply - pelvis_3d_lands.fcsv -')

print('2D/3D registration of pelvis..')

run_cmd('xreg-hip-surg-pelvis-single-view-regi-2d-3d TCGA-G2-A3VY_ct.nii.gz pelvis_3d_lands.fcsv 2-c73e_pd.h5 2-c73e_pelvis_regi.h5 2-c73e_regi_debug.h5 --no-log-remap -s TCGA-G2-A3VY_ct_full_pelvis-label.nii.gz')

run_cmd('xreg-draw-xray-scene -i -l 2-c73e_pd.h5 pelvis.ply 2-c73e_pelvis_regi.h5 pelvis_3d_lands.fcsv 2-c73e_pelvis_regi.h5')

run_cmd('xreg-regi2d3d-replay --proj-ds 0.5 --video-fps 10 2-c73e_regi_debug.h5')

view_movie('edges.mp4')
view_movie('mov.mp4')

0 comments on commit c06440d

Please sign in to comment.