Dynamic Phantoms - xcist/documentation GitHub Wiki
CatSim now provides a very basic means of producing dynamic simulations. This is done by specifying a series of phantom files, each of which provides a snapshot of the phantom at a particular time. The filenames of these phantoms must all be identical except for the specification of the phase number. For example, if simulation of a phantom with 200 unique phases is desired, 200 different files would be needed. These could, for example, be named my_dynamic_1.ppm, my_dynamic_2.ppm, my_dynamic_3.ppm, …, my_dynamic_200.ppm
. In the .cfg
file, the phantom filename would be specified as my_dynamic_&.ppm
in this case. Other changes to the config file might be as follows:
cfg.dynamic_phantom = 1;
Nphases = 200;
bpm = 60;
cfg.phase_length = (60/bpm)*(ones(1,Nphases)/Nphases);
start_time=0;
% optional dynamic phantom parameters
% (do not specify one but not the other)
cfg.phase_start_time = start_time;
cfg.current_phase = 1;
Note that there are two required variables. The first is the cfg.dynamic_phantom
flag, which must be set to 1. The other is cfg.phase_length
, which is a vector that specifies the amount of time that the phantom is in each state. There are also two optional parameters (cfg.phase_start_time
and cfg.current_phase
) that allow one to specify a phase other than the first phase as the initial phase.
There is a second means for specifying a dynamic phantom that requires only one filename. To use this second dynamic phantom mode, you must set the following:
cfg.dynamic_phantom = 2;
This second dynamic mode is only compatible with the .ppm
format. Each time the phantom is reloaded (i.e., you are in a new phase), the .ppm
file is re-executed. The mechanism for making the phantom different is that the cfg
parameter time is available when the .ppm
file is executed. Thus, to make a sphere that moves in z sinusoidally at a rate of one period per second and an amplitude of 10 mm, you could do this:
obj.center = [0 0 10*sin(cfg.time*2*pi)];
obj.type = ‘Ellipsoid’;
obj.half_axes = [50 50 50];
eval(update);
This assumes you are using the .ppm
header specified in example.ppm