Open cpinter opened 1 year ago
I will work on this.
@lassoan Please feel free to add/change anything in the above description.
@mattjolley 5D image sequence export finally works for my test data! (The test case is: 5 RGBA images of 320x320x1)
This is the header of the output NRRD:
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned char
dimension: 5
space dimension: 4
sizes: 4 320 320 1 5
space directions: none (1,0,0,0) (0,1,0,0) (0,0,1,0) (0,0,0,1.0185579796238055e-313)
kinds: vector domain domain domain domain
encoding: gzip
space origin: (0,0,0,1)
When loading back in Slicer as Volume (and not as Sequence, as that direction is not yet implemented), the first image appears correctly, which is what is expected.
For the record, this is the experimental topic branch: https://github.com/cpinter/Slicer/tree/volume-sequence-io-5D
Working on the reader class, and I have some questions to @lassoan about how to continue.
The current state is that I have the vtkITKImageSequenceReader
class, which now can split the test sequence file into frames (time point volumes) if used directly. Now I want to make it a proper VTK algorithm, and also to support all the scalar types and component types. But first things first, the VTK pipeline. What is new to me is that here we have N output ports, and we don't know how many until we run the filter.
FillOutputPortInformation
method that contains this line: info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1);
Is this enough for any number of output ports?vtkITKExecuteDataFromFile
, which has a vtkITKImageSequenceReader* self
argument, and the second argument is typically the output. What should it be? vtkCollection* outputFrames
?vtkITKExecuteDataFromFile
call from RequestData
, without actually loading the image? Any idea how to approach this?Thank you!
Also, leaving this topic here for the record: https://discourse.itk.org/t/using-splitcomponentsimagefilter-to-split-by-dimension/6603
This week I finished the implementation of the 5D IO in a way that our basic use case should now work. There is a crash the source of which I don't know. I asked @lassoan about it. I'll continue there next week.
Reading the first test sequence file happened without a crash!
There are still many details to finalize, but at least the circle is now closed with:
.seq.nrrd
One of the things to fix is that the writer assigns a 0 voxel spacing in the sequence frames dimension, which the reader cannot handle. See these two headers (on the right is a header that loads successfully, on the left is the header after saving the data Slicer loads from the right one):
Also, the component voxel type was changed from RGBA to vector, but the scalar types and vector types part needs to be revised anyway.
Update to @mattjolley considering he can't attend today's meeting:
We agreed with @lassoan yesterday that
I'll do this as priorities allow.
Recognition of metadata of the volume to read without reading the entire volume is now possible. Here's the branch: https://github.com/cpinter/Slicer/tree/volume-sequence-io-5D
Currently there is no way to save/load sequences of vector images, because the vtkMRMLVolumeSequenceStorageNode class does not support images with more than one scalar components.
Describe the solution you'd like
Add support in said class to save/load vector image sequences.
Describe alternatives you've considered
We could improve the vtkTeemNRRDReader/vtkTeemNRRDWriter classes, or start using the vtkITKArchetypeImageSeriesReader/vtkITKImageWriter classes in vtkMRMLVolumeSequenceStorageNode instead.