Skip to content

Commit c06440d

Browse files
authored
Merge pull request #9 from rg2/devel
Latest changes from devel branch - preparing for next release.
2 parents 066b678 + 5864a11 commit c06440d

File tree

5 files changed

+79
-13
lines changed

5 files changed

+79
-13
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
2828
#endif ()
2929

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

3333
set (CMAKE_CXX_STANDARD "11" CACHE STRING "C++ Standard (needs at least 11)")
3434
mark_as_advanced(CMAKE_CXX_STANDARD)

dist/dist_readme/README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| xReg: Modeling and Registration Software for Surgery |
44
| |
55
| Executable Programs |
6-
| v2020.12.13.0 |
6+
| v2021.09.19.0 |
77
| |
88
| Robert Grupp (grupp@jhu.edu) |
99
+------------------------------------------------------+
@@ -17,7 +17,7 @@ See the following pages for more information about the library and tools:
1717
The walkthrough link above contains demonstrations (with data) on example usages of these tools.
1818

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

docker/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
## Introduction
44
The files in this directory may be used to create Docker images with builds of the xReg software.
55
Ubuntu and CentOS base images are supported.
6-
The releases of exectuable programs for CentOS 7 and Ubuntu 16.04 were created using this pipeline.
6+
The releases of exectuable programs for CentOS 7 and Ubuntu 16.04, 18.04, 20.04 were created using this pipeline.
77

88
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`).
99
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`).
1010
When these arguments are not provided, Ubuntu 16.04 is used by default.
1111

12+
## GitHub Packages
13+
The images containing all xReg dependencies are available as GitHub packages [here](https://github.com/rg2?tab=packages&repo_name=xreg).
14+
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.
15+
More images may be made available as needed/requested.
16+
1217
## List of Files
1318
* `Dockerfile.centos_dev_base`
1419
* Installs packages needed for xReg build on *CentOS* and also builds a recent version of CMake
@@ -26,8 +31,7 @@ A copy/pastable list of shell commands is provided in [`example_commands`](examp
2631

2732
Specific commands are also listed below:
2833

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

3236
### Ubuntu 16.04 Build
3337

docker/example_commands

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ docker build -t xreg-deps-${OS_NAME}-${OS_VERSION} --build-arg os_name=${OS_NAME
1818

1919
# Build xReg
2020
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
21-
i
2221

2322
# Create xReg distributable
2423
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

tests/wiki_cmds.py

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,26 @@ def macos_check_for_dyld_vars():
132132
time.sleep(5)
133133

134134
if __name__ == '__main__':
135+
mac_slicer_default_path = '/Applications/Slicer.app/Contents/MacOS/Slicer'
136+
win_slicer_default_path = 'C:\\Program Files\\Slicer 4.10.2\\Slicer.exe'
137+
linux_slicer_default_path = '$HOME/Slicer-4.10.2-linux-amd64/Slicer'
138+
135139
if ('--help' in sys.argv) or ('-h' in sys.argv):
136-
print('TODO: help message')
140+
print('This script exists for semi-automatic functional testing by executing the commands '
141+
'found on the xReg wiki walkthrough and having the user manually verify the outputs.\n'
142+
'Usage: python {} [<xReg bin directory>]\n'
143+
'xReg binaries will be found via the PATH environment variable when an xReg bin '
144+
'directory is not provided.\n'
145+
'When available on the system, 3D Slicer is automatically invoked to visualize volumes.'
146+
'Depending on the operating system, 3D Slicer is assumed to reside in one of the '
147+
'following locations:\n'
148+
' * MacOS: {}\n'
149+
' * Windows: {}\n'
150+
' * Linux: {}'.format(
151+
os.path.basename(sys.argv[0]),
152+
mac_slicer_default_path,
153+
win_slicer_default_path,
154+
linux_slicer_default_path))
137155
sys.exit(0)
138156
elif len(sys.argv) > 1:
139157
xreg_bin_dir = sys.argv[1]
@@ -155,18 +173,14 @@ def macos_check_for_dyld_vars():
155173
slicer_path = None
156174

157175
if platform.system() == 'Darwin':
158-
mac_slicer_default_path = '/Applications/Slicer.app/Contents/MacOS/Slicer'
159-
160176
if os.path.exists(mac_slicer_default_path):
161177
slicer_path = mac_slicer_default_path
162178
elif platform.system() == 'Windows':
163-
win_slicer_default_path = 'C:\\Program Files\\Slicer 4.10.2\\Slicer.exe'
164-
165179
if os.path.exists(win_slicer_default_path):
166180
# enclose the path in quotes to handle any spaces
167181
slicer_path = '\"{}\"'.format(win_slicer_default_path)
168182
elif platform.system() == 'Linux':
169-
linux_slicer_default_path = os.path.expandvars('$HOME/Slicer-4.10.2-linux-amd64/Slicer')
183+
linux_slicer_default_path = os.path.expandvars(linux_slicer_default_path)
170184

171185
if os.path.exists(linux_slicer_default_path):
172186
slicer_path = linux_slicer_default_path
@@ -354,3 +368,52 @@ def macos_check_for_dyld_vars():
354368
view_movie('edges.mp4')
355369
view_movie('mov.mp4')
356370

371+
#################################################################
372+
# Based off: https://github.com/rg2/xreg/wiki/Example%3A-TCIA-Hip-Radiograph-Rigid-Registration
373+
if True:
374+
print('Workflow for 2D/3D registration to real pelvis radiograph...')
375+
376+
print('3D DICOM conversion/resampling...')
377+
378+
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)
379+
380+
extract_zip('TCGA-G2-A3VY_ct.zip', 'TCGA-G2-A3VY_ct_dcm')
381+
382+
run_cmd('xreg-convert-dicom-vols --one TCGA-G2-A3VY_ct_dcm TCGA-G2-A3VY_ct.nii.gz')
383+
384+
view_vol('TCGA-G2-A3VY_ct.nii.gz', slicer_path)
385+
386+
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)
387+
388+
download_file('https://github.com/rg2/xreg/wiki/examples/tcia_hip_radiograph_rigid_2d_3d/pelvis_3d_lands.fcsv', use_existing=True)
389+
390+
print('Creating 3D mesh of pelvis...')
391+
run_cmd('xreg-create-mesh TCGA-G2-A3VY_ct_full_pelvis-label.nii.gz pelvis.ply 1 2')
392+
393+
print('2D DICOM conversion...')
394+
395+
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)
396+
397+
extract_zip('TCGA-G2-A3VY_radiographs_1.zip', 'TCGA-G2-A3VY_radiographs')
398+
399+
download_file('https://github.com/rg2/xreg/wiki/examples/tcia_hip_radiograph_rigid_2d_3d/2-c73e.fcsv', use_existing=True)
400+
401+
run_cmd('xreg-convert-dicom-radiograph TCGA-G2-A3VY_radiographs/2-c73e4bdf6c7d19772d00acd2891965fa.dcm 2-c73e_pd.h5 2-c73e.fcsv')
402+
403+
run_cmd('xreg-remap-tile-proj-data -d 0.25 -o 2-c73e_pd.h5 2-c73e_remap.png')
404+
405+
view_image('2-c73e_remap.png')
406+
407+
run_cmd('xreg-draw-xray-scene -i -l 2-c73e_pd.h5 pelvis.ply - pelvis_3d_lands.fcsv -')
408+
409+
print('2D/3D registration of pelvis..')
410+
411+
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')
412+
413+
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')
414+
415+
run_cmd('xreg-regi2d3d-replay --proj-ds 0.5 --video-fps 10 2-c73e_regi_debug.h5')
416+
417+
view_movie('edges.mp4')
418+
view_movie('mov.mp4')
419+

0 commit comments

Comments
 (0)