An open API service indexing awesome lists of open source software.

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

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