This class will enable you to mix multiple frames together.
The mixer class is enabled through the 2D Mode: "DB Class management" interface. Once you have an instance of this class in your database tree, a new "Mixer" button will be present in the Modes menu. This button will open the mixer's interface.
The "Discriminate Channels On" and "Associate Frames On" parameter are used to select which frames is mixed with which. The user specify an equation that is used to compute the pixels of the mixed frames. Each mixed frame can be composed from the pixels of multiple source frames. Each of the frame that can be used to compose the mix is a "channel". Usually the channels are series from the original acquisition. If these channels have multiple frames each, then the "Associate Frames On" parameter is used to specify which of the frames within each channel are to be associated together.
Special key word can be used for these parameters. "Path", "Name" and "Suffix". Using "Path" or "Suffix" in the "Discriminate Channels On" parameter can be used to compare the TAG results of the same GLI image segmented multiple times. For repeatability studies, the same GLI image can be copied in different directories, segmented by different users and read back in sliceO. The "Path" parameter can then be used to discriminate each instance of the GLI and an equation like "((T1-T2)>0) ? (T1-T2) : (T2-T1)" can be used to display the difference between each TAG results.
For example, the default values, Discriminate Channels On = "Series Description" (DICOM tag (0008,103E) and Associate Frames On = "Slice Location" (DICOM tag (0020,1041)) is used to mix frames from the MR IDEAL sequences.
The mixer's equation syntax
The mixer equation is used to specify the value of the pixels "mixed" image. The new pixel values are compute for each pixel of the mixed frames. Depending on the type of the resulting image, you either have one equation (intensity for GLI images) or 3 equations (RGB color components for RGB images) for the pixel values of the image and 1 equation for the TAG values associated with the images. These equations are evaluated for each pixels of the mixed frames each time you click on the "Update DB" button.
The mixer use the following terms:
N is the number of channels available.
Px represent the GLI pixel values of channel x
Tx represent the TAG pixel values of channel x
Rx, Gx, Bx represent the red, green and blue component of the pixels of channel x
MAXx, MINx, represent the maximum and minimum GLI pixel values of channel x
Vx represent the value of slider x
Si, Sj or Sk are used for summations of the following term over the N channels. (Ex: "SiPi / N" is the mean value of the pixels.)
In the previous terms, "x" can be the channel number (1 to N), the character "c" for the channel associated with the TAG value, or one of "i", "j" and "k" if you use a summation.
You can also use constants and sliceO variables in your equation. Ex: $A + P1 * 255
These terms are combined together using the following operators:
|
+, -, *, /, % |
Mathematical operators |
|
<, >, = |
Test operators |
|
&, |, ^ |
Logical operators |
|
? |
Conditional operator |
And the functions:
|
log, log10, exp, sqrt, abs, sin, cos, tan, asin, acos, atan |
Unary functions |
|
min, max, pow, atan2 |
Binary functions |
The mathematical operators
+, -, *, / are the standard plus, minus, multiplication and division operators.
% is the modulo operator, A % B is replaced by the rest in the integer division of A by B. Ex: 5 % 3 = 2
The test operators
A = B replaced by 1 if A equal to B, 0 otherwise
A < B replaced by 1 if A is smaller than B, 0 otherwise
A > B replaced by 1 if A is greater than B, 0 otherwise
The logical operators
| is a logical Or
& is a logical And
^ is a logical Xor
The conditional operator
The syntax is: Test ? A : B
if Test is true then A is evaluated
if Test is false then B is evaluated
The unari functions:
Use a syntax like: "abs(P1)" with 1 argument in parenthesis.
The binari functions:
Use a syntax like: "max(P1,P2)" with 2 comma separated arguments inside the parenthesis.
The sliceOmatic variables (starting with $) can also be used in the equations.
Ex: simple "cross fade" between 2 channels. Mixed pixels = channel 1 if V1=0, channel 2 if V1 = 1
(P1 * (1-V1)) + (P2 * V1)
Ex: Conditional statement with sliceO variable ($A). The resulting pixels are normalized between 0 and 255
( P1 > $A ) ? (P1 / MAX1) * 255 : (P2 / MAX2) * 255
Ex: You can use parenthesis in summations.
Si(Pi-100) is equivalent to (P1-100) + (P2-100) + ... + (PN-100)
Note:
|
|
Note:
|
|
Note:
|
|
Note:
|
|
|
|
|
Original images without mixer
|
|
|
|
Mixer interface. The 2 channels (Fat & Water) are mixed. |
From the Graphic Interface
Sub-Modes |
The Mixer class interface has 3 sub tabs: Info, Mixer and Channels.
|
|
|
|
|
Info text |
This text window display a short summary of the equation syntax along with the current number of available channels and their names.
|
Update DB |
Recompute the database tree using the new parameters |
|
|
|
|
In this interface you can edit the equation used to compute the mixed frame's pixel values. Depending on whether the mixer is in GLI or RGB mode, you can edit the GLI equation, or the 3 RGB equations.
|
|
GLI or RGB equations |
You can edit the GLI pixel equation. You must press the "Enter" key to activate your changes. If the equation you enter is invalid, an error message will be displayed in the text window. You either have access to 1 "Grey Level Image" equations, or 3 color component equations depending on the choice made in the "Channels" tab of the interface.
The default equation is the mean value of the pixels of the N channels: "SiPi / N"
|
TAG equation
|
You can edit the TAG pixel equation. You must press the "Enter" key to activate your changes. If the equation you enter is invalid, an error message will be displayed in the text window. The resulting TAG values will be clipped to the range 0 to $TAG_Nb.
|
Valuator sliders |
Only the sliders used in the equations will be displayed. The sliders can be adjusted from 0 to 1.
|
Bypass buttons |
There is one bypass button per channel. Clicking this button will change the equation so that the frames from the selected channel are displayed. It is a quick way to visualize the original frames of each channel.
|
Update DB |
Recompute the database tree using the new parameters. |
|
|
|
|
||||||||
|
|||||||||
Discriminate |
The value of this tag decides in which channel the frames from each file will go.
3 text strings can also be used for special cases: •"Path" can be used to create a channel for each TAG file directory present in the DB. •"Name" can be used to create a channel for each GLI file name present in the DB. •"Suffix" can be used to create a channel for each TAG file suffix present in the DB.
|
||||||||
Associate |
The value of this tag will be used to match frames across channels.
3 text strings can also be used for special cases: •"Path" can be used to create a channel for each TAG file directory present in the DB. •"Name" can be used to create a channel for each GLI file name present in the DB. •"Suffix" can be used to create a channel for each TAG file suffix present in the DB.
|
||||||||
TAG to channel |
This parameter decides the channel for the TAG files. If you modify the TAG values, only the images associated with this channel will be modified.
|
||||||||
Mix mode |
The mixed frames can be either in "GLI" or "RGB" mode.
In GLI mode, the mixer use one equation to compute a grey level value for the pixels
In RGB mode, the miser use 3 equations to compute the red, green and blue color components of the pixels:
|
||||||||
Update DB |
Recompute the database tree using the new parameters. |
|
|
From the Display Area
There is no display area interaction specific to this class.
From the Keyboard
The following commands can also be mapped to keyboard keys as a shortcut:
|
|
|
|
Key map |
Action |
|
|
|
|
"SHIFT_1" |
Toggle Bypass mode for channel 1 to 9. |
|
to |
|
|
"SHIFT_9"
|
From the Command Line
System Variables defined in this library:
|
$MIXER_MODE |
(U16) |
|
|
$MIXER_EQ_GLI |
(S) |
The GLI pixel equation. |
|
$MIXER_EQ_TAG |
(S) |
The TAG pixel equation. |
|
$MIXER_EQ_RED |
(S) |
The 3 component pixel equation if the image is in color. |
|
$MIXER_EQ_GRN |
(S) |
|
|
$MIXER_EQ_BLU |
(S) |
Commands recognized in this library:
Mixer: Mode (GLI|RGB)
Set the current mixer mode. The values are: 0 for GLI and 128 for RGB.
Mixer: Equation (GLI|TAG|Red|Grn|Blu) Equation
Set the one of the equations to the string "equation" (be sure to protect it with quotes).
Mixer: Tag [t_level] channel_id
Set the "Tag" parameter for the different levels of the class. This parameter is used to select which of the channels will have the associated TAG files. The TAG files are accessible by all channels, but when they are saved, the file name is based on the selected channel.
Mixer: Associate [t_level] group element
Set the "Associate" parameter for the different levels of the class.
Mixer: Discriminate [t_level] group element
Set the "Discriminate" parameter for the different levels of the class.
Mixer: Bypass [t_level] [channel] (on|off|toggle)
Set the "Bypass" parameter for the different levels of the channels.
|
|