Skip to content

Commit

Permalink
Merge pull request #6 from rg2/devel
Browse files Browse the repository at this point in the history
Development leading up to next release
  • Loading branch information
rg2 authored Dec 13, 2020
2 parents dca7ba9 + 53b92da commit 7298208
Show file tree
Hide file tree
Showing 13 changed files with 530 additions and 88 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 @@ if (APPLE)
endif ()

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

set (CMAKE_CXX_STANDARD "11" CACHE STRING "C++ Standard (needs at least 11)")
mark_as_advanced(CMAKE_CXX_STANDARD)
Expand Down
85 changes: 8 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Although the following capabilities currently only exist in an internal version
## Building
A standard CMake configure/generate process is used.
It is recommended to generate Ninja build files for fast compilation.
Example scripts for building all dependencies and the xReg repository are provided for [POSIX systems](example_build_script) (e.g. MacOS and Linux) and [Windows](example_build_script_win.cmd).
Example scripts for building all dependencies and the xReg repository are provided for POSIX systems (e.g. MacOS and Linux) [here](example_build_script) and [here](example_build_script_2), and also for [Windows](example_build_script_win.cmd).
The [docker](docker) directory demonstrates how Docker may be used to build the software.

### Dependencies
Expand All @@ -72,82 +72,13 @@ The [docker](docker) directory demonstrates how Docker may be used to build the
* Included with MacOS
* Optional: [ffmpeg](https://ffmpeg.org) is used for writing videos when it is found in the system path. The OpenCV video writer is used if ffmpeg is not available.

## Testing
Functional testing is available in the form of a [python script](tests/wiki_cmds.py) that runs the commands found on the [wiki walkthrough](https://github.com/rg2/xreg/wiki#walkthrough).
Results of the commands need to be examined by the user and determined to be successful or failures.
All necessary data is downloaded automatically.
When the appropriate visualization programs are available on the system, the script also automatically loads the output data for inspection.

## License and Attribution
The software is available for use under the [MIT License](LICENSE).

If you have found this software useful in your work, we kindly ask that you cite the most appropriate references below:
```
Grupp, Robert B., et al. "Pose estimation of periacetabular osteotomy fragments with intraoperative X-ray navigation." IEEE Transactions on Biomedical Engineering 67.2 (2019): 441-452.
----------------------------------------------------------------------
@article{grupp2019pose,
title={Pose estimation of periacetabular osteotomy fragments with intraoperative {X}-ray navigation},
author={Grupp, Robert B and Hegeman, Rachel A and Murphy, Ryan J and Alexander, Clayton P and Otake, Yoshito and McArthur, Benjamin A and Armand, Mehran and Taylor, Russell H},
journal={IEEE Transactions on Biomedical Engineering},
volume={67},
number={2},
pages={441--452},
year={2019},
publisher={IEEE}
}
```
```
Grupp, Robert B., Mehran Armand, and Russell H. Taylor. "Patch-based image similarity for intraoperative 2D/3D pelvis registration during periacetabular osteotomy." OR 2.0 Context-Aware Operating Theaters, Computer Assisted Robotic Endoscopy, Clinical Image-Based Procedures, and Skin Image Analysis. Springer, Cham, 2018. 153-163.
----------------------------------------------------------------------
@incollection{grupp2018patch,
title={Patch-based image similarity for intraoperative {2D}/{3D} pelvis registration during periacetabular osteotomy},
author={Grupp, Robert B and Armand, Mehran and Taylor, Russell H},
booktitle={OR 2.0 Context-Aware Operating Theaters, Computer Assisted Robotic Endoscopy, Clinical Image-Based Procedures, and Skin Image Analysis},
pages={153--163},
year={2018},
publisher={Springer}
}
```
```
Grupp, Robert B., et al. "Automatic annotation of hip anatomy in fluoroscopy for robust and efficient 2D/3D registration." International Journal of Computer Assisted Radiology and Surgery (2020): 1-11.
----------------------------------------------------------------------
@article{grupp2020automatic,
title={Automatic annotation of hip anatomy in fluoroscopy for robust and efficient {2D}/{3D} registration},
author={Grupp, Robert B and Unberath, Mathias and Gao, Cong and Hegeman, Rachel A and Murphy, Ryan J and Alexander, Clayton P and Otake, Yoshito and McArthur, Benjamin A and Armand, Mehran and Taylor, Russell H},
journal={International Journal of Computer Assisted Radiology and Surgery},
pages={1--11},
publisher={Springer}
}
```
```
Grupp, Robert, et al. "Fast and automatic periacetabular osteotomy fragment pose estimation using intraoperatively implanted fiducials and single-view fluoroscopy." Physics in Medicine & Biology (2020).
----------------------------------------------------------------------
@article{grupp2020fast,
title={Fast and automatic periacetabular osteotomy fragment pose estimation using intraoperatively implanted fiducials and single-view fluoroscopy},
author={Grupp, Robert and Murphy, Ryan and Hegeman, Rachel and Alexander, Clayton and Unberath, Mathias and Otake, Yoshito and McArthur, Benjamin and Armand, Mehran and Taylor, Russell H},
journal={Physics in Medicine \& Biology},
year={2020},
publisher={IOP Publishing}
}
```
```
Grupp, R., et al. "Pelvis surface estimation from partial CT for computer-aided pelvic osteotomies." Orthopaedic Proceedings. Vol. 98. No. SUPP_5. The British Editorial Society of Bone & Joint Surgery, 2016.
----------------------------------------------------------------------
@inproceedings{grupp2016pelvis,
title={Pelvis surface estimation from partial {CT} for computer-aided pelvic osteotomies},
author={Grupp, R and Otake, Y and Murphy, R and Parvizi, J and Armand, M and Taylor, R},
booktitle={Orthopaedic Proceedings},
volume={98},
number={SUPP\_5},
pages={55--55},
year={2016},
organization={The British Editorial Society of Bone \& Joint Surgery}
}
```
```
Grupp, Robert B., et al. "Smooth extrapolation of unknown anatomy via statistical shape models." Medical Imaging 2015: Image-Guided Procedures, Robotic Interventions, and Modeling. Vol. 9415. International Society for Optics and Photonics, 2015.
----------------------------------------------------------------------
@inproceedings{grupp2015smooth,
title={Smooth extrapolation of unknown anatomy via statistical shape models},
author={Grupp, Robert B and Chiang, H and Otake, Yoshito and Murphy, Ryan J and Gordon, Chad R and Armand, Mehran and Taylor, Russell H},
booktitle={Medical Imaging 2015: Image-Guided Procedures, Robotic Interventions, and Modeling},
volume={9415},
pages={941524},
year={2015},
organization={International Society for Optics and Photonics}
}
```
If you have found this software useful in your work, we kindly ask that you cite the most appropriate references listed [here](https://github.com/rg2/xreg/wiki/Licensing-and-Attribution).
74 changes: 74 additions & 0 deletions dist/build_all_docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# MIT License
#
# Copyright (c) 2020 Robert Grupp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import os.path
import sys

import subprocess as sp

def build_dev_base(os_name, os_version, xreg_git_dir):
sp.check_call('docker build -t xreg-dev-base-{0}-{1} --build-arg os_name={0} --build-arg os_version={1} -f {2}/docker/Dockerfile.{0}_dev_base {2}'.format(os_name, os_version, xreg_git_dir), shell=True)

def build_deps(os_name, os_version, xreg_git_dir):
sp.check_call('docker build -t xreg-deps-{0}-{1} --build-arg os_name={0} --build-arg os_version={1} -f {2}/docker/Dockerfile.xreg-deps {2}'.format(os_name, os_version, xreg_git_dir), shell=True)

def build_xreg(os_name, os_version, xreg_git_dir):
sp.check_call('docker build -t xreg-{0}-{1} --build-arg os_name={0} --build-arg os_version={1} -f {2}/docker/Dockerfile.xreg {2}'.format(os_name, os_version, xreg_git_dir), shell=True)

def build_xreg_dist(os_name, os_version, xreg_git_dir, xreg_dist_str):
dist_img_name = 'xreg-dist-{0}-{1}'.format(os_name, os_version)

sp.check_call('docker build -t {4} --build-arg os_name={0} --build-arg os_version={1} --build-arg xreg_dist_str={3} -f {2}/docker/Dockerfile.xreg-dist-bin {2}'.format(os_name, os_version, xreg_git_dir, xreg_dist_str, dist_img_name), shell=True)

cont_id = sp.check_output('docker create {}'.format(dist_img_name), shell=True).decode().strip()

dist_file_name = '{}-{}-{}.tar.gz'.format(xreg_dist_str, os_name, os_version)

sp.check_output('docker cp {}:/{} .'.format(cont_id, dist_file_name), shell=True)

sp.check_call('docker rm {}'.format(cont_id), shell=True)

if __name__ == '__main__':
if len(sys.argv) < 2:
sys.stderr.write('Usage: {} <xreg src dir> [<xreg ver string>]\n'.format(os.path.basename(sys.argv[0])))
sys.stderr.flush()
sys.exit(1)

xreg_src_dir = sys.argv[1]

xreg_dist_prefix = 'xreg'

if len(sys.argv) > 2:
xreg_dist_prefix = '{}-{}'.format(xreg_dist_prefix, sys.argv[2])

# os name --> list of os version
configs_to_build = { 'ubuntu' : [ '16.04', '18.04', '20.04' ], 'centos' : [ '7' ] }

for os_name, os_versions in configs_to_build.items():
for os_ver in os_versions:
build_dev_base(os_name, os_ver, xreg_src_dir)
build_deps(os_name, os_ver, xreg_src_dir)
build_xreg(os_name, os_ver, xreg_src_dir)

build_xreg_dist(os_name, os_ver, xreg_src_dir, xreg_dist_prefix)


5 changes: 3 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.09.26.0 |
| v2020.12.13.0 |
| |
| Robert Grupp (grupp@jhu.edu) |
+------------------------------------------------------+
Expand Down Expand Up @@ -40,7 +40,8 @@ This software is provided under the terms of the MIT license and a copy of the l
found in the "LICENSE" file.

If you have found this software useful in your work, we kindly ask that you cite the most
appropriate references below:
appropriate references listed below. If you are unsure which work to cite, please see this wiki
page for guidance: https://github.com/rg2/xreg/wiki/Licensing-and-Attribution.


Grupp, Robert B., et al. "Pose estimation of periacetabular osteotomy fragments with intraoperative X-ray navigation." IEEE Transactions on Biomedical Engineering 67.2 (2019): 441-452.
Expand Down
22 changes: 20 additions & 2 deletions dist/make_linux_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
import glob
import subprocess as sp

kDEBUG = False

def dbg_print(s):
if kDEBUG:
print(s)

def get_lib_deps(exe_path):
ldd_lines = sp.check_output('ldd {}'.format(exe_path), shell=True).decode().splitlines()

Expand All @@ -35,6 +41,9 @@ def get_lib_deps(exe_path):
for l in ldd_lines:
toks = l.split('=>')
if len(toks) > 1:
if toks[1].strip() == 'not found':
raise ValueError('dep. not found for: {}'.format(toks[0].strip()))

lib_path = toks[1][:toks[1].find('(0x')].strip()

if lib_path:
Expand Down Expand Up @@ -63,11 +72,20 @@ def update_rpath(exe_path):
xreg_exes = glob.glob('{}/bin/xreg-*'.format(xreg_install_prefix))

for exe in xreg_exes:
dbg_print('copying exe: {}'.format(exe))
shutil.copy(exe, dst_bin_path)


dbg_print(' checking deps...')
for dep_src_path in get_lib_deps(exe):
if not os.path.exists('{}/{}'.format(dst_lib_path,os.path.basename(dep_src_path))):
lib_name = os.path.basename(dep_src_path)

dbg_print(' {}'.format(lib_name))
if not os.path.exists('{}/{}'.format(dst_lib_path, lib_name)):
dbg_print(' copying...')
shutil.copy(dep_src_path, dst_lib_path)

update_rpath('{}/{}'.format(dst_lib_path, lib_name))

dbg_print(' updating RPATH...')
update_rpath('{}/{}'.format(dst_bin_path, os.path.basename(exe)))

Loading

0 comments on commit 7298208

Please sign in to comment.