https://github.com/sydney-informatics-hub/tiff2vrml
Takes a stack of TIFF files and converts to a 3D VRML file
https://github.com/sydney-informatics-hub/tiff2vrml
Last synced: over 1 year ago
JSON representation
Takes a stack of TIFF files and converts to a 3D VRML file
- Host: GitHub
- URL: https://github.com/sydney-informatics-hub/tiff2vrml
- Owner: Sydney-Informatics-Hub
- Created: 2023-11-05T21:59:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-16T11:50:54.000Z (over 2 years ago)
- Last Synced: 2025-01-22T11:13:05.422Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 383 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Helper code
```
import numpy as np
import tifffile as tiff
import os
import scipy
import matplotlib.pyplot as plt
# Read the tiff files, assume have sorteable filenames 001.tif, 002.tif etc.
tiff_dir = "data/"
tiff_files = [f for f in os.listdir(tiff_dir) if f.endswith(".tif")]
tiff_files.sort()
# Load the first TIFF file to get its dimensions
first_tiff = tiff_files[0]
height, width = first_tiff.shape
num_slices = len(tiff_files)
# Create a numpy array to store the volume
volume = np.zeros((height, width, num_slices), dtype=np.uint8)
# Iterate through TIFF files and populate a volume
for i, tiff_file in enumerate(tiff_files):
print(tiff_file)
tiff_data = tiff.imread(os.path.join(tiff_dir, tiff_file))
volume[:, :, i] = tiff_data
```
# Try
* Open3d
* vtk
* ?? others
# Now do magic
Export vrml