The TF4M Dental Manager application requires dcm2niix to convert DICOM files (CBCT scans) to NIfTI format. To provide a seamless user experience, dcm2niix is bundled with the application so end users don't need to install it separately.
.\setup_dcm2niix.ps1This PowerShell script will:
- Download the latest dcm2niix from GitHub
- Extract and place it in the
binfolder - Verify it works correctly
- Download dcm2niix from: https://github.com/rordenlab/dcm2niix/releases
- For Windows: Download
dcm2niix_win.zip - Extract
dcm2niix.exefrom the zip file - Place it in
bin/dcm2niix.exe(create thebinfolder if it doesn't exist)
When running from source (python main.py), the application searches for dcm2niix in this order:
- bin folder (RECOMMENDED):
<project_root>/bin/dcm2niix.exe - Virtual environment:
<venv>/Scripts/dcm2niix.exe - Project .venv:
<project_root>/.venv/Scripts/dcm2niix.exe - System PATH
When running as a compiled executable, the application searches in this order:
- Bundled bin folder:
<app_dir>/bin/dcm2niix.exe - Legacy location:
<app_dir>/dcm2niix.exe - System PATH
The PyInstaller spec file (TF4M_Dental_Manager.spec) is configured to automatically include the entire bin folder in the bundle.
- Ensure
bin/dcm2niix.exeexists (runsetup_dcm2niix.ps1) - Install PyInstaller:
pip install pyinstaller
# 1. Setup dcm2niix (if not already done)
.\setup_dcm2niix.ps1
# 2. Build the application
.\build_windows.ps1
# Or manually:
pyinstaller TF4M_Dental_Manager.spec --cleanThe build process will:
- Include all files from the
binfolder in the bundle - Place them in
dist/TF4M_Dental_Manager/bin/ - Make them accessible to the application at runtime
After building, verify that dcm2niix is included:
# Check if the file exists in the distribution
Test-Path "dist\TF4M_Dental_Manager\bin\dcm2niix.exe"
# Run the built application and check the logs
.\dist\TF4M_Dental_Manager\TF4M_Dental_Manager.exe
# Check the log file:
Get-Content "dist\TF4M_Dental_Manager\logs\tf4m_app.log"
# Look for lines like: "Found bundled dcm2niix: ..."When distributing the application:
Simply zip the entire dist/TF4M_Dental_Manager folder. It contains:
TF4M_Dental_Manager/
├── TF4M_Dental_Manager.exe (main application)
├── bin/
│ └── dcm2niix.exe (bundled tool)
├── _internal/ (Python runtime and dependencies)
└── ...other files
If using NSIS or another installer, make sure to include the bin folder:
- Source:
dist/TF4M_Dental_Manager/bin/* - Destination:
$INSTDIR/bin/
If users report dcm2niix errors, check the logs:
- Open the Console Log Viewer (Help → View Console Log)
- Search for "dcm2niix"
- Look for error messages
Common issues:
Problem: "dcm2niix executable not found"
- Solution: The
bin/dcm2niix.exewas not included in the build - Fix: Re-run
setup_dcm2niix.ps1and rebuild
Problem: "dcm2niix.exe is not recognized as an internal or external command"
- Solution: File permissions issue or antivirus blocking
- Fix: Check file properties, unblock if needed
Problem: Application crashes when processing CBCT
- Solution: dcm2niix may be corrupted
- Fix: Download a fresh copy from GitHub releases
To verify which dcm2niix is being used:
# In development
.\bin\dcm2niix.exe --version
# In distribution
.\dist\TF4M_Dental_Manager\bin\dcm2niix.exe --versionImportant: dcm2niix is licensed under the BSD 3-Clause License. When distributing your application:
- Include the dcm2niix license file
- Provide attribution to the dcm2niix project
- See: https://github.com/rordenlab/dcm2niix
Example attribution text:
This application includes dcm2niix (https://github.com/rordenlab/dcm2niix)
dcm2niix is licensed under the BSD 3-Clause License
Copyright (c) 2014-2023 Chris Rorden, University of South Carolina
To update dcm2niix to a newer version:
- Delete the old
bin/dcm2niix.exe - Run
setup_dcm2niix.ps1again (it will download the latest version) - Or manually download and replace from GitHub releases
- File name:
dcm2niix.exe - Download:
dcm2niix_win.zipfrom releases
- File name:
dcm2niix(no .exe extension) - Download:
dcm2niix_mac.zipfrom releases - May need to:
chmod +x bin/dcm2niix - May need to allow in Security settings
- File name:
dcm2niix(no .exe extension) - Download:
dcm2niix_lnx.zipfrom releases - May need to:
chmod +x bin/dcm2niix
Place different versions in the bin folder with different names:
bin/
├── dcm2niix.exe (current version - used by application)
├── dcm2niix_v1.0.20.exe (backup/test version)
└── dcm2niix_latest.exe (latest test version)
Swap by renaming files to test different versions.
Enable verbose logging in the application and check:
- Console Log Viewer (Help → View Console Log)
- Filter by "dcm2niix" or "cbct_converter"
- Look for command line arguments and output
The logs will show:
- Where dcm2niix was found
- The exact command being executed
- stdout and stderr from dcm2niix
- Any errors or warnings
✅ For Development:
- Run
setup_dcm2niix.ps1once - dcm2niix will be used from
bin/folder
✅ For Building:
- Ensure
bin/dcm2niix.exeexists - Run build script
- bin folder is automatically included
✅ For Distribution:
- Include entire
dist/TF4M_Dental_Managerfolder - bin folder with dcm2niix will be bundled
- No user installation required!
✅ For Users:
- Just run the .exe
- Everything works out of the box
- No additional setup needed