Hi,
I’m new to Slicer and Python
I want to load 512x512x619x9 uint16 data from microscopy into Slicer as volume sequence data.
First, I save ome.tiff as nrrd (C2withmeta.nrrd) via Fiji after I checked the properties.
I tried load it in slicer but it became 512x512x5571.
Then I used python to edit and save nrrd data via CMD.
(Python 3.8.11 (default, Aug 3 2021, 06:49:12) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32)
Here are the code
import numpy as np
import nrrd
import os
filename = "~/Desktop/C2nrrd/C2withmeta.nrrd"
filedata, fileheader = nrrd.read(filename)
filedata.shape
(512, 512, 5571)
newdata = filedata.reshape(619,512,512,9)
newheader = {
'type': 'uint16',
'encoding': 'raw',
'endian': 'big',
'dimension': 4,
'sizes': [619, 512, 512,9],
'kinds': ['list', 'domain', 'domain', 'domain'],
'labels': ['frame', '', '', ''],
'space': 'right-anterior-superior',
'space dimension': 3,
'space directions': [[0.184687, 0. , 0. ], [0. , 0.184687, 0. ], [0. , 0. , 3.75 ]],
'space origin': [ 0, 0, 0],
'space units': ['s','microns', 'microns', 'microns'],
'measurement frame': [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]],
'axis 0 index type': 'numeric',
'axis 0 index values': tuple(range(0,619))
}
outname = "~Desktop/C2nrrd/C2new2.nrrd"
nrrd.write (outname, newdata, newheader)
I tried save .nrrd or .seq.nrrd and tried load them in slicer as volum or sequence, but all failed.
when I load it as sequence, error
Error: Loading ~/Desktop/C2nrrd/C2new.seq.nrrd - Failed to read node C2new_1 (vtkMRMLSequenceNode2) from filename=‘~/Desktop/C2nrrd/C2new.seq.nrrd’
when I load it as volume
Error: Loading ~/Desktop/C2nrrd/C2new.seq.nrrd - load failed.
So I want to know what is the problem?