Saving a Phantom and the Displacements of the Spins #721
-
|
Hi, I have created a phantom and added some motions in it using the available functions. I could also save the phantom using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi Sammir, Thank you for using Koma and for testing this functionality. If what you want is to store the positions of all the spins at arbitrary time instants, that is possible by combining the If, on the other hand, you want each spin to have its own associated time instants (different from those of the other spins), I’m afraid this is not very feasible at the moment. For each motion, only a single Let’s go back to the first case. Suppose you have the spin positions at an arbitrary set of time instants (I’ll do this in 2D, but it would be exactly the same for the 3D case): using KomaMRI
obj = brain_phantom2D()
t = [0.0, 0.1, 0.3, 0.5, 0.8, 1.0] # Arbitrary time instants
dx = 5e-3 * rand(length(obj), length(t))
dy = 5e-3 * rand(length(obj), length(t))
# Note that dx and dy contain DISPLACEMENTS with respect
# to the initial position at each time instant for each spin
# These must be the input for the path function.
# If you had positions instead of displacements,
# you would need to compute the displacements
# as the difference between the current position and the initial position.
dz = zeros(length(obj), length(t)) # No movement in z
# We define the time curve from the time vector. To understand why the
# second argument is needed, see: https://juliahealth.org/KomaMRI.jl/dev/reference/2-koma-base/#KomaMRIBase.TimeCurve
time_curve = TimeCurve(t, range(0, 1, length(t)))
# We define the motion with the path function.
obj.motion = path(dx, dy, dz, time_curve)
# The information is now stored in the phantom. We can now visualize it,
# save it to a .phantom file with the write_phantom function, etc.
write_phantom(obj, "brain_with_random_motion.phantom")I hope this helps. If you have further questions, feel free to explain your use case in a bit more detail and we can see if we can find a way to address it. Best regards, |
Beta Was this translation helpful? Give feedback.
Hi Sammir,
Thank you for using Koma and for testing this functionality. If what you want is to store the positions of all the spins at arbitrary time instants, that is possible by combining the
pathfunction with theTimeCurvestructure (I can show you a small example of this below).If, on the other hand, you want each spin to have its own associated time instants (different from those of the other spins), I’m afraid this is not very feasible at the moment. For each motion, only a single
TimeCurveis stored (that is, a single time vector). One could define an independent motion for each spin, with its ownTimeCurve, but that would be extremely inefficient 😄.Let’s go back to the first ca…