Convert InVivo .inv dental CBCT volumes to Enhanced CT DICOM
Project description
inv2dcm
inv2dcm is a Python package and CLI for converting InVivo .inv files into Enhanced CT DICOM (.dcm).
It is built for dental CBCT / cone beam CT data associated with InVivoDentalViewer, CliniView, and Anatomage workflows, including scans from systems such as Instrumentarium Dental ORTHOPANTOMOGRAPH OP 3D Pro.
The .inv files handled here use the INVFile XML container format, with an AppendedData payload containing JPEG 2000-compressed voxel data.
If you are searching for an INV to DICOM converter, InVivo INV file reader, dental CBCT to DICOM tool, cone beam CT to pydicom, or a way to convert .inv to 3D Slicer / VolView compatible DICOM, this package is intended for that use case.
Features
- Converts proprietary
.invvolume files to Enhanced CT DICOM - Outputs a single multi-frame DICOM file
- Reads scan metadata from the INV XML header
- Decodes embedded JPEG 2000 codestreams in pure Python via
imagecodecs - Produces output readable by:
pydicom- 3D Slicer
- VolView
- other DICOM-capable medical imaging tools
- Includes both a Python library API and a CLI command:
inv2dcm
Installation
From source
pip install .
Development install
pip install -e .
CLI usage
After installation, the console script is available as:
inv2dcm
Convert a file
inv2dcm scan.inv
This writes <input-stem>.dcm next to the source file.
Convert to a specific output path
inv2dcm scan.inv output/scan.dcm
Control DICOM window metadata
inv2dcm scan.inv output/scan.dcm --window auto
Available modes:
auto— derive a sane window center/width from the volume datasource— preserve the source INV window metadatanone— omit DICOM window center/width metadata
Python library usage
inv2dcm is importable as a normal Python library, so it is suitable for publishing on PyPI and embedding in larger imaging workflows.
Simple conversion
from pathlib import Path
from inv2dcm import convert_inv_to_dicom
convert_inv_to_dicom(Path("scan.inv"), Path("scan.dcm"), window_mode="auto")
Inspect decoded metadata and volume data
from pathlib import Path
from inv2dcm import load_inv
inv = load_inv(Path("scan.inv"))
print(inv.metadata)
print(inv.volume.shape)
Build the pydicom dataset yourself
from pathlib import Path
from inv2dcm import build_enhanced_ct, load_inv
inv = load_inv(Path("scan.inv"))
ds = build_enhanced_ct(inv, Path("scan.dcm"))
print(ds.SOPClassUID)
print(ds.NumberOfFrames)
Public API
load_inv(path)build_enhanced_ct(inv, output_path, window_mode="auto")convert_inv_to_dicom(input_path, output_path, window_mode="auto")
Verify with pydicom
import pydicom
ds = pydicom.dcmread("scan.dcm")
print(ds.NumberOfFrames)
print(ds.Rows, ds.Columns)
print(ds.pixel_array.shape)
View the converted DICOM in the browser
You can drag the generated .dcm file directly into VolView:
This is a convenient way to inspect the converted dental CBCT volume in the browser without installing a desktop viewer.
What kind of INV files are supported?
This project targets InVivo dental CBCT .inv files using the INVFile container format.
In practice, that means files with:
- an XML document rooted at
INVFile - bytes that begin with
<INVFile - an
AppendedDatablock - JPEG 2000 codestream containers storing the voxel data
That matches the structure documented by reverse-engineering work on InVivo / CliniView / Anatomage-related CBCT archives.
Reverse-engineering references
This package was informed by prior work on the InVivo / CliniView .inv format and related dental CBCT tooling:
- holland.sh — Digital CBCT scans: https://holland.sh/post/digital-cbct-scans/
- InvivoConvert: https://github.com/AstrisCantCode/InvivoConvert
- InvivoExtractor: https://github.com/Bostwickenator/InvivoExtractor
- Reverse engineering my head: https://dev-with-alex.blogspot.com/2018/03/reverse-engineering-my-head.html
Output format
The generated DICOM file uses:
- SOP Class: Enhanced CT Image Storage
- Transfer Syntax: Explicit VR Little Endian
- Photometric Interpretation:
MONOCHROME2 - Multi-frame volume storage for easy loading in Python and modern viewers
Why this package exists
The .inv format is awkward to use in standard Python medical imaging workflows. inv2dcm converts proprietary InVivo CBCT data into standard DICOM so it can be opened with pydicom, reviewed in 3D Slicer, or inspected in VolView.
Development
The CLI entry point is:
inv2dcm→inv2dcm.py
You can also run it directly during development:
python inv2dcm.py scan.inv scan.dcm
Keywords
INV to DICOM, InVivo INV converter, INVFile parser, dental CBCT DICOM converter, cone beam CT DICOM, JPEG 2000 medical imaging, pydicom INV import, InVivoDentalViewer export, CliniView INV parser, Anatomage InVivo, VolView DICOM viewer.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inv2dcm-1.0.0.tar.gz.
File metadata
- Download URL: inv2dcm-1.0.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d1c494ebc571055ef787ba904d28e38b4829a8ee6a83404bd619962379a3abd
|
|
| MD5 |
14521870a838855d784986555564fd70
|
|
| BLAKE2b-256 |
b91a5fdf431acda82d6eada4946259e556bedcc83bb328d050e8fc33253bf924
|
File details
Details for the file inv2dcm-1.0.0-py3-none-any.whl.
File metadata
- Download URL: inv2dcm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe5cb95531c3aa5718b2448c577ae9b11f5175371871fc933bb40dc6a5cf8299
|
|
| MD5 |
d5f964e4ed98635e0be35021534e085e
|
|
| BLAKE2b-256 |
d89da580fb50414fd4455505e10d5c844f11f8383c32f596416c9157de345f55
|