BiTS (Bivariate Tomography Segmentation) is an advanced, open-source software tool designed for processing and interpreting large volumes of tomographic data across multiple scientific disciplines. It employs the bivariate histogram, allowing for intuitive and precise segmentation of 3D tomographic data based on two correlated volumetric datasets.
- Interactive 2D histogram-based segmentation
- Support for both polygon and rectangular selection methods
- Real-time segmentation updates
- GPU acceleration (with CPU fallback)
- Compatibility with various tomographic data formats
- Python 3.7+
- PyQt5
- NumPy
- Matplotlib
- PyTorch (for GPU acceleration)
- Create a conda repository:
conda create -n BITS python=3.10 - Activate the conda repository:
conda activate BITS - Install pytorch with the appropriate CUDA:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
- Clone the repository:
git clone https://github.com/OriolSansPlanell/BiTS.git - Navigate to the BiTS directory:
cd BiTS\project_files - Install required packages:
pip install -r requirements.txt - Run the application:
python main.py
To begin using BiTS:
- Launch the application
- Load your tomographic volumes (File > Load Volume 1/2)
- The 2D histogram will automatically generate
- Use polygon or rectangular selection tools to define regions of interest
- Observe real-time segmentation results
- A: Volume loading buttons
- B: 2D Histogram display
- C: Segmentation display
- D: Selection type toggle
- E: Slice navigation slider
- F: Save/Load settings buttons
- Automatically generated from two loaded volumes
- Logarithmic scale option for better visualization of data distribution in certain datasets
-
Polygon selection: Freeform selection for complex regions
-
Rectangular selection: Quick selection of rectangular regions
-
Zoom in and out on the histogram in order to fine-tune the selection.
- Immediate visual feedback on segmentation results
- Efficient processing for large datasets
- XY, XZ, and YZ plane options for comprehensive data exploration (under construction)
- Save segmentation settings for later use
- Load previous settings for consistency across sessions
- Load Volumes: Import your X-ray and neutron tomography data
- Explore Data: Use the 2D histogram to understand data distribution
- Select Region: Use polygon or rectangular selection to define ROI
- Refine Segmentation: Adjust selection as needed, observing real-time updates
- Analyze Results: Examine segmented data across different slices and planes
- Save Results: Export segmented volumes and masks
BiTS automatically utilizes GPU acceleration when available.
Will be implemented as soon as one afternoon is free.
Coming soon...
Common issues and their solutions:
Issue: Volumes fail to load Solution: Ensure files are in the correct format (TIFF stack) Issue: GPU acceleration not working Solution: Check CUDA installation and PyTorch GPU support
Q: What file formats are supported? A: Currently, BiTS supports TIFF stack formats for tomographic data. Q: Can I use BiTS for single-volume segmentation? A: While BiTS is optimized for bivariate data, it can be used with a single volume by duplicating the data for the second input.
Segmentation Algorithm BiTS uses a histogram-based segmentation approach. The algorithm works as follows:
- Generate 2D histogram from two input volumes
- User defines ROI on the histogram
- Each voxel is classified based on its position relative to the ROI in the histogram space
Performance Optimizations
PyTorch for GPU acceleration of computationally intensive tasks Efficient numpy operations for CPU processing
We welcome contributions to BiTS!
BiTS is released under the MIT License. See the LICENSE file for more details.
