How to synthesize the 2D image after each layer correction back into 3D?

I have a cardiac MRI motion correction code that splits the original 4D nii into multiple slices for correction, which is actually modifying the saved affine matrix, but this code saves the corrected results as separate slices of nii(x,y,1,T). Now I need to save the first frame as a 3D nii, then the problem arises, how to integrate these single layer slices (x,y,1), but if the array data is stacked, the correction cannot be reflected, the difficulty is the integration of the affine matrix, because each layer may be Angle corrected, there will be some overlap between these layers。

The closest thing to what you need, that I know of, is PlusVolumeReconstructor. It reconstructs a 3D volume from a collection of 2D images with known spatial position and orientation. Your case is a more specialized/constrained version of that. @lassoan Is this the best solution, or do you have another suggestion?

If slices overlap then the only suitable tool I know for 3D reconstruction is PLUS volume reconstructor (if slices never overlap then you can reconstruct by applying a grid transform).

All you need to do is to write position and orientation of each frame in custom fields of a standard NRRD file (in sequence NRRD file convention (.seq.nrrd), one file per timepoint, Seq_Frame [FrameIndex]_[TransformName]Transform and Seq_Frame[FrameIndex]_[TransformName]TransformStatus fields set for each frame), drag-and-drop into 3D Slicer, then use Volume Reconstruction module, provided by SlicerIGT extension).

You can write all time points into a single file and reconstruct a 4D sequence with a Python script similar to this.

1 Like