{"id":20874443,"url":"https://github.com/imagingdatacommons/pyplastimatch","last_synced_at":"2025-05-12T15:30:37.006Z","repository":{"id":58310201,"uuid":"392690124","full_name":"ImagingDataCommons/pyplastimatch","owner":"ImagingDataCommons","description":"Python wrapper for Plastimatch.","archived":false,"fork":false,"pushed_at":"2024-08-27T15:12:19.000Z","size":56968,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-01T14:40:20.330Z","etag":null,"topics":["dicom-images","medical-image-processing","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pyplastimatch/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ImagingDataCommons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-04T13:01:18.000Z","updated_at":"2024-08-27T15:12:22.000Z","dependencies_parsed_at":"2024-01-27T06:00:22.093Z","dependency_job_id":"f9444263-bd37-42e9-8291-f3f0e29128c7","html_url":"https://github.com/ImagingDataCommons/pyplastimatch","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.24,"last_synced_commit":"d58f2955bb12874cd83bee91405b0e60d70f8f54"},"previous_names":["imagingdatacommons/pyplastimatch","aim-harvard/pyplastimatch"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpyplastimatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpyplastimatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpyplastimatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpyplastimatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ImagingDataCommons","download_url":"https://codeload.github.com/ImagingDataCommons/pyplastimatch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225139289,"owners_count":17426950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dicom-images","medical-image-processing","python"],"created_at":"2024-11-18T06:32:32.325Z","updated_at":"2024-11-18T06:34:04.600Z","avatar_url":"https://github.com/ImagingDataCommons.png","language":"Jupyter Notebook","readme":"# PyPlastimatch\n\nPyPlastimatch is a python wrapper for [Plastimatch](http://plastimatch.org/), an ITK-based open source software designed for volumetric medical image processing and radiation therapy applications.\n\nThe main reason behing the development of PyPlastimatch is being able to use the Plastimatch functions within python scripts without having to code using `os.system` or `subprocess` all the time. Also, we are working on making the output of some of the functions Plastimatch implements for evaluation (e.g., Dice Coefficient and Hausdorff Distance) more pythonic/easily usable in python-based data analysis pipelines.\n\nTogether with the wrapping functions, we are also developing simple but handy functions that can be used for quick data exploration (e.g., simple widgets based on ipywidgets) in ipython notebooks and JupyterLab.\n\n\u003cbr\u003e\n\nPyPlastimatch is completely independent from the main software Plastimatch, and it is being developed mainly for internal use. For this reason, most of the Plastimatch functions might be missing. If you would like to see something added or point out how we could improve anything in the wrapper, you are very welcome to [open an issue at the issue page](https://github.com/AIM-Harvard/pyplastimatch/issues).\n\n\n# Table of Contents\n- [Install Via pip](#install-via-pip)\n- [Dependencies](#dependencies)\n  - [Python](#python)\n  - [Plastimatch](#plastimatch)\n  - [dcmqi](#dcmqi)\n- [Usage Example](#usage-example)\n- [Run in a Docker Container](#ubuntu-2204-lts-plastimatch-docker-container)\n- [Further Reading](#further-reading)\n\n\n# Install Via `pip`\n\nPyPlastimatch can be installed via pip:\n\n```\npip install pyplastimatch\n```\n\n# Dependencies\n\n## Python\n\nIf you decide to clone the PyPlastimatch repository and not to install it with `pip`, in order to run the code as intended, all the python libraries found in `requirements.txt` must be installed. This can be done running the command:\n\n```\npip3 install -r requirements.txt\n```\n\n## Plastimatch\n\nSince PyPlastimatch is a python wrapper and doesn't include any processing code, Plastimatch must be installed on the machine separately.\n\n### Ubuntu 20.04 LTS\n\nFor users running Ubuntu 20.04 LTS (and distributions that fetch the same packages), Plastimatch can be installed simply by running:\n\n```\nsudo apt install plastimatch\n```\n\n### Ubuntu 22.04 LTS\n\nUsers running Ubuntu 22.04 LTS will unfortunately not be able to install Plastimatch via `apt` (see [this Issue on the official Plastimatch GitLab](https://gitlab.com/plastimatch/plastimatch/-/issues/87)). To remedy this, we compiled a binary file for Ubuntu 22.04 LTS that you can find [in our releases](https://github.com/AIM-Harvard/pyplastimatch/releases) and you can download running the following once PyPlastimatch is installed (from a Python3 shell):\n\n```\nfrom pyplastimatch.utils.install import install_precompiled_binaries\ninstall_precompiled_binaries()\n```\n\nand, of course, its equivalent from CLI:\n\n```\nRUN python3 -c 'from pyplastimatch.utils.install import install_precompiled_binaries; install_precompiled_binaries()'\n```\n\nThe plastimatch binary we provide was compiled dinamically, so it will not work without installing some dependencies (`itk` via `pip`, and some system dependencies that the `install_precompiled_binaries()` function takes care of automatically). Depending on the python version you are using and your environment (i.e., packages already installed), you might need to install `itk` via `pip` before installing `pyplastimatch`.\n\nIn the future, we might support binaries pre-compiled statically, and for other distributions/OSs. \n\n### Other OSs\n\nFor Windows users, Plastimatch can be installed following [the guide at this webpage](http://plastimatch.org/windows_installation.html).\n\n### Building from Source\n\nPlastimatch can also be build from source following [the guide at this webpage](http://plastimatch.org/building_plastimatch.html). The guide could be slightly outdated, but it should be enough to get you started.\n\n## DCMQI\n\nSome functions might be based on the [DICOM for Quantitative Imaging (dcmqi) library](https://github.com/QIICR/dcmqi), that must be installed separately (e.g., under Linux, download the latest release, move the content of the `bin` folder under `usr/local/bin`, and make the files executable).\n\n\n# Usage Example\n\nYou can try PyPlastimatch on Google Colab without installing anything. To open the Colab notebook, click here: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/AIM-Harvard/pyplastimatch/blob/main/notebooks/pyplastimatch_MWE.ipynb) \n\nSince Plastimatch and this wrapper are being used for the development of AI-base medical image analysis pipelines on the [NIH CRDC Imaging Data Commons](https://datacommons.cancer.gov/repository/imaging-data-commons) platform, some example notebooks using PyPlastimatch can be found at the [IDC-Examples/notebooks](https://github.com/ImagingDataCommons/IDC-Examples/tree/master/notebooks) repository as well.\n\nNote: provided you have a Google Cloud Platform project correctly set up, you will be able to run this and all the other notebooks for free, entirely on the cloud. Should you find any issues with the notebooks or would like to learn more, you can get in touch here, on the IDC repositories, or the [IDC forum](https://discourse.canceridc.dev/).\n\n# Ubuntu 22.04 LTS Plastimatch Docker Container\n\nIf you want to test Plastimatch for Ubuntu 22.04 LTS, you can use the Docker image we shared for this purpose under `dockerfiles`.\n\n## Build the Docker Container\n\nTo build the Ubuntu 22.04 LTS Platimatch Docker container, run the following commands from the root of the PyPlastimatch repository:\n\n```\ncd dockerfiles/\n\ndocker build --tag pypla_22.04 . --no-cache\n```\n\n## Run the Docker Container\n\nAssuming the data you want to convert/manipulate with Plastimatch is stored at `/home/dennis/Desktop/sample_data/`, the Docker command to run will look like the following\n\n```\ndocker run --rm -it --entrypoint bash -v /home/dennis/Desktop/sample_data/:/app/data pypla_22.04\n```\n\nThis will mount the data directory to the container's `/app/data` directory, and you can then run Plastimatch commands from within the container. For example, if `/home/dennis/Desktop/sample_data/` is structured as follows:\n\n```\n(base) dennis@W2-S1:~$ tree /home/dennis/Desktop/sample_data/ -L 1\n/home/dennis/Desktop/sample_data/\n└── dicom\n```\n\nThen, once inside the container, you can run the following command to convert the DICOM files to a volume saved in the NRRD format:\n\n```\ncd /app/data\n\nplastimatch convert --input input_dcm/ --output-img test.nrrd\n```\n\n\n# Further Reading\n[Paolo Zaffino's (un)\"official\" wrapper](https://gitlab.com/plastimatch/plastimatch/-/tree/master/extra/python).\n\nFurther discussion about the python-wrapping of Plastimatch can be found at [this discourse.slicer thread](https://discourse.slicer.org/t/python-wrapping-of-plastimatch/6722/10).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimagingdatacommons%2Fpyplastimatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimagingdatacommons%2Fpyplastimatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimagingdatacommons%2Fpyplastimatch/lists"}