Class PatientSlice
The PatientSlice class should be used any time a 2D slice of the ModelImage is needed for rendering purposes.
The PatientSlice class can be used to extract any axial, coronal, sagittal slice from the ModelImage, or slices in the native file coordinates.
The PatientSlice class can also be used to extract diagonal slices through the ModelImage. This is done by setting the four corners of the diagonal cut-plane, using file coordinates for the four points of the cut-plane bounding box.
The PatientSlice.showUsingOrientation() function extracts a 2D slice from the ModelImage into a 2D packed-int array. This array can be passed to the BufferImage class for viewing 2D images, or it can be passed to the Texture2D class to create texture-mapped polygons. Or the 2D array can be used for algorithms that operate on the 2D ModelImage slices.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag indicating whether to use the threshold1 value:.private booleanFlag indicating whether to use the threshold2 value:.private ModelImageimageA:.private ModelImageThe current active image:.private ModelImageimageB:.private float[]The imageBuffer that stores the current ModelImage slice data for imageA:.private float[]The imageBuffer that stores the current ModelImage slice data for imageB:.private float[]colocalization imageBuffer:.private ModelImagecolocalization image:.private int[]image extents in the local coordinate system:.private ModelLUTModelLUT lookup table for gray-scale ModelImages: imageA lut.private ModelLUTModelLUT lookup table for gray-scale ModelImages: imageB lut.private float[]Mask data when a surface is loaded into the SurfaceRender, for blending with the PlaneRender image.private float[]Color normalization factor:.private int[]lookup table for mapping ModelImage data values to color for imageA:.private int[]lookup table for mapping ModelImage data values to color for imageB:.private WildMagic.LibFoundation.Mathematics.ColorRGB[]Color offset factor:.private booleanFlag indicating whether the slice is axis-aligned or diagonal (for RFA probe rotataions).private booleanFlag indicating whether to do TriLinear interpolation when exporting a diagonal slice:.private booleanFlag indicating whether or not the slice represents an axis-aligned orientation or a diagonal orientation through the ModelImage volume: true when the RFA probe is activated in the SurfaceRender:.private booleanFlag indicating whether the slice or LUT changed:.private WildMagic.LibFoundation.Mathematics.Vector3fcurrent slice positions in FileCoordinates:.private WildMagic.LibFoundation.Mathematics.Vector3f[]The rotated non-axis aligned corners of the slice, from the RFA probe rotation in the SurfaceRender:.private WildMagic.LibFoundation.Mathematics.Vector3fcurrent slice positions in local coordinates:.private intThis indicates which of the Patient coordinate systems the slice represents: either AXIAL, SAGITTAL, CORONAL, or UNKNOWN.private ModelRGBModelRGB lookup table for color ModelImages: imageA rgb table.private ModelRGBModelRGB lookup table for color ModelImages: imageB rgb table.private intThe 2D slice to extract from the ModelImage:.private floatThreshold value:.private floatThreshold value:.private intFor 4D data, the timeSlice multiplier for imageA:.private intFor 4D data, the timeSlice multiplier for imageB:.private booleanFlag indicating whether to threshold the blue color channel:.private booleanFlag indicating whether to threshold the green color channel:.private booleanFlag indicating whether to threshold the red color channel:. -
Constructor Summary
ConstructorsConstructorDescriptionPatientSlice(ModelImage _imageA, ModelLUT _LUTa, ModelImage _imageB, ModelLUT _LUTb, int _orientation) Constructs a PatientSlice with the given ModelImages, LUTs, and orientation. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanDetermines if a slice is axis-aligned, based on the m_kFourCorners[] four corners of the slice in 3D Model space.private voidcalcMaxNormColors(ModelImage kImage, int index) calculates the color normalization factors.private voidcenter()Calculate the volume center in PatientCoordinates and set the z-value for this slice.voidDefault dispose.private voidfillImageBuffer(int slice, boolean bShowMask) Gets the image data based on the orientation, either AXIAL, CORONAL, SAGITTAL, UNKNOWN_ORIENT, or a diagonal slice if the plane is a diagonal cut-plane through the ModelImage.voidfinalize()Clean up memory used by the component.Returns the ModelLUT or ModelRGB based on which image is currently active, either imageA or imageB and they type of image (color or grayscale).booleanReturns whether the current slice is axis-aligned or rotated.private floatgetBufferValue(boolean logMagDisplay, boolean isComplexBuffer, float[] imageBuffer, int ind4) Helper method for calculating complex values.WildMagic.LibFoundation.Mathematics.Vector3fReturn the current center of the volume in FileCoordinates.private voidgetColorMapped(ModelRGB modelRGBT, int[] RGBIndexBuffer, int imageIndex, float[] imageBuffer, int index, WildMagic.LibFoundation.Mathematics.ColorRGBA colorMapped) Get the color from the RGB lookup table:int[]Returns the local image extents for the PatientSlice orientation.getLUTa()Accessor that returns the LUT for image A.getLUTb()Accessor that returns the LUT for image B.intThis indicates which of the 3 tri-image components we are currently in; either AXIAL, SAGITTAL, or CORONAL.getRGBTa()Accessor that returns the RGBT for image A.getRGBTb()Accessor that returns the RGBT for image B.voidsetActiveImage(ModelImage kImage) Sets which image is currently active.voidsetBuffers(float[] imgBufferA, float[] imgBufferB) The frame in which the image(s) is displayed, allocates the memory and uses this method to pass the references to the buffers.voidsetCenter(int i, int j, int k) DOCUMENT ME!voidsetDiagonalVerts(WildMagic.LibFoundation.Mathematics.Vector3f[] fourCorners) Sets the four corners of the bounding box for this slice in FileCoordinates so that the volume data can be exported along a diagonal slice, based on the positions of the input bounding box.voidsetHasThreshold1(boolean hasThreshold1) Sets the hasThreshold1 for setPaintBuffers.voidsetHasThreshold2(boolean hasThreshold2) Sets the hasThreshold2 for setPaintBuffers.voidsetImageA(ModelImage image) Sets imageA.voidsetImageB(ModelImage image) Sets imageB.voidsetImageColocalize(ModelImage imageColocalize) Sets the colocalize image.voidvoidsetInterpolate(boolean bInterpolate) Sets the export flag for displaying diagonal to use TriLinear interpolation of the volume data.voidAccessor that sets the LUT for image A.voidAccessor that sets the LUT for image B.voidCauses the data to be redrawn with new RGBTA values:voidCauses the data to be redrawn with new RGBTB values:voidsetShowDiagonal(boolean bDiagonal) Sets the export for this Slice to be along a diagonal.voidsetThresholdColors(boolean useRedThreshold, boolean useGreenThreshold, boolean useBlueThreshold) Sets the booleans for using thresholds in showUsingOrientation.voidsetThresholds(float threshold1, float threshold2) Sets the thresholds.booleanshowUsingOrientation(int tSlice, int[] bufferA, int[] bufferB, boolean forceShow, boolean bShowMask) For generating the display of one or two ModelImages (imageA and imageB).booleanshowUsingOrientation(int tSlice, int[] bufferA, int[] bufferB, boolean forceShow, boolean bBlend, float fAlpha, boolean bShowMask) For generating the display of one or two ModelImages (imageA and imageB).booleanupdateSlice(int newSlice) updates the slice value when the wheel is moved or the page_up, page_down keys are pressed.
-
Field Details
-
hasThreshold1
private boolean hasThreshold1Flag indicating whether to use the threshold1 value:. -
hasThreshold2
private boolean hasThreshold2Flag indicating whether to use the threshold2 value:. -
imageA
imageA:. -
imageActive
The current active image:. -
imageB
imageB:. -
imageBufferA
private float[] imageBufferAThe imageBuffer that stores the current ModelImage slice data for imageA:. -
imageBufferB
private float[] imageBufferBThe imageBuffer that stores the current ModelImage slice data for imageB:. -
imageBufferColocalize
private float[] imageBufferColocalizecolocalization imageBuffer:. -
imageColocalize
colocalization image:. -
localImageExtents
private int[] localImageExtentsimage extents in the local coordinate system:. -
LUTa
ModelLUT lookup table for gray-scale ModelImages: imageA lut. -
LUTb
ModelLUT lookup table for gray-scale ModelImages: imageB lut. -
m_afMask
private float[] m_afMaskMask data when a surface is loaded into the SurfaceRender, for blending with the PlaneRender image. Included here for rendering performance -
m_afNormColor
private float[] m_afNormColorColor normalization factor:. -
m_aiRGBIndexBufferA
private int[] m_aiRGBIndexBufferAlookup table for mapping ModelImage data values to color for imageA:. -
m_aiRGBIndexBufferB
private int[] m_aiRGBIndexBufferBlookup table for mapping ModelImage data values to color for imageB:. -
m_akOffset
private WildMagic.LibFoundation.Mathematics.ColorRGB[] m_akOffsetColor offset factor:. -
m_bAxisAligned
private boolean m_bAxisAlignedFlag indicating whether the slice is axis-aligned or diagonal (for RFA probe rotataions). -
m_bInterpolate
private boolean m_bInterpolateFlag indicating whether to do TriLinear interpolation when exporting a diagonal slice:. -
m_bShowDiagonal
private boolean m_bShowDiagonalFlag indicating whether or not the slice represents an axis-aligned orientation or a diagonal orientation through the ModelImage volume: true when the RFA probe is activated in the SurfaceRender:. -
m_bUpdateImage
private boolean m_bUpdateImageFlag indicating whether the slice or LUT changed:. -
m_kFilePoint
private WildMagic.LibFoundation.Mathematics.Vector3f m_kFilePointcurrent slice positions in FileCoordinates:. -
m_kFourCorners
private WildMagic.LibFoundation.Mathematics.Vector3f[] m_kFourCornersThe rotated non-axis aligned corners of the slice, from the RFA probe rotation in the SurfaceRender:. -
m_kPatientPoint
private WildMagic.LibFoundation.Mathematics.Vector3f m_kPatientPointcurrent slice positions in local coordinates:. -
orientation
private int orientationThis indicates which of the Patient coordinate systems the slice represents: either AXIAL, SAGITTAL, CORONAL, or UNKNOWN. -
RGBTA
ModelRGB lookup table for color ModelImages: imageA rgb table. -
RGBTB
ModelRGB lookup table for color ModelImages: imageB rgb table. -
slice
private int sliceThe 2D slice to extract from the ModelImage:. -
threshold1
private float threshold1Threshold value:. -
threshold2
private float threshold2Threshold value:. -
timeSliceA
private int timeSliceAFor 4D data, the timeSlice multiplier for imageA:. -
timeSliceB
private int timeSliceBFor 4D data, the timeSlice multiplier for imageB:. -
useBlueThreshold
private boolean useBlueThresholdFlag indicating whether to threshold the blue color channel:. -
useGreenThreshold
private boolean useGreenThresholdFlag indicating whether to threshold the green color channel:. -
useRedThreshold
private boolean useRedThresholdFlag indicating whether to threshold the red color channel:.
-
-
Constructor Details
-
PatientSlice
public PatientSlice(ModelImage _imageA, ModelLUT _LUTa, ModelImage _imageB, ModelLUT _LUTb, int _orientation) Constructs a PatientSlice with the given ModelImages, LUTs, and orientation. The orientation parameter may take on any of the following values: FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT- Parameters:
_imageA- Model of the image that will be displayed_LUTa- LUT used to display imageA_imageB- Model of the image that will be displayed_LUTb- LUT used to display imageB_orientation- display orientation of the image
-
-
Method Details
-
disposeLocal
public void disposeLocal()Default dispose. -
finalize
Clean up memory used by the component. -
getActiveLookupTable
Returns the ModelLUT or ModelRGB based on which image is currently active, either imageA or imageB and they type of image (color or grayscale).- Returns:
- the active LUT/RGB table.
-
getAxisAligned
public boolean getAxisAligned()Returns whether the current slice is axis-aligned or rotated.- Returns:
- true when axis-aligned, false otherwise.
-
getCenter
public WildMagic.LibFoundation.Mathematics.Vector3f getCenter()Return the current center of the volume in FileCoordinates.- Returns:
- volume center in FileCoordinates
-
getExtents
public int[] getExtents()Returns the local image extents for the PatientSlice orientation.- Returns:
- image extents in local coordinates.
-
getLUTa
Accessor that returns the LUT for image A.- Returns:
- LUTa
-
getLUTb
Accessor that returns the LUT for image B.- Returns:
- LUTb
-
getOrientation
public int getOrientation()This indicates which of the 3 tri-image components we are currently in; either AXIAL, SAGITTAL, or CORONAL.- Returns:
- The orientation, either AXIAL, SAGITTAL, or CORONAL.
-
getRGBTa
Accessor that returns the RGBT for image A.- Returns:
- RGBTA
-
getRGBTb
Accessor that returns the RGBT for image B.- Returns:
- RGBTB
-
setActiveImage
Sets which image is currently active.- Parameters:
kImage- the currently active image.
-
setBuffers
public void setBuffers(float[] imgBufferA, float[] imgBufferB) The frame in which the image(s) is displayed, allocates the memory and uses this method to pass the references to the buffers.- Parameters:
imgBufferA- storage buffer used to display image AimgBufferB- storage buffer used to display image B
-
setCenter
public void setCenter(int i, int j, int k) DOCUMENT ME!- Parameters:
i- FileCoordinates volume center ij- FileCoordinates volume center jk- FileCoordinates volume center k
-
setImageExtents
public void setImageExtents() -
setDiagonalVerts
public void setDiagonalVerts(WildMagic.LibFoundation.Mathematics.Vector3f[] fourCorners) Sets the four corners of the bounding box for this slice in FileCoordinates so that the volume data can be exported along a diagonal slice, based on the positions of the input bounding box.- Parameters:
fourCorners- the bounding box of the diagonal slice in FileCoordinates
-
setHasThreshold1
public void setHasThreshold1(boolean hasThreshold1) Sets the hasThreshold1 for setPaintBuffers.- Parameters:
hasThreshold1- whether the paint buffer has a threshold1
-
setHasThreshold2
public void setHasThreshold2(boolean hasThreshold2) Sets the hasThreshold2 for setPaintBuffers.- Parameters:
hasThreshold2- whether the paint buffer has a threshold2
-
setImageA
Sets imageA.- Parameters:
image- imageA
-
setImageB
Sets imageB.- Parameters:
image- imageB
-
setImageColocalize
Sets the colocalize image.- Parameters:
imageColocalize- the colocalization image
-
setInterpolate
public void setInterpolate(boolean bInterpolate) Sets the export flag for displaying diagonal to use TriLinear interpolation of the volume data.- Parameters:
bInterpolate- when true use TriLinear interpolation of the volume data
-
setLUTa
Accessor that sets the LUT for image A.- Parameters:
LUT- New LUTa
-
setLUTb
Accessor that sets the LUT for image B.- Parameters:
LUT- New LUTb
-
setRGBTA
Causes the data to be redrawn with new RGBTA values:- Parameters:
RGBT- the new RGBT for imageA
-
setRGBTB
Causes the data to be redrawn with new RGBTB values:- Parameters:
RGBT- the new RGBT for imageB
-
setShowDiagonal
public void setShowDiagonal(boolean bDiagonal) Sets the export for this Slice to be along a diagonal.- Parameters:
bDiagonal- if true, render this slice as a diagonal
-
setThresholdColors
public void setThresholdColors(boolean useRedThreshold, boolean useGreenThreshold, boolean useBlueThreshold) Sets the booleans for using thresholds in showUsingOrientation.- Parameters:
useRedThreshold- whether to threshold the red paint bufferuseGreenThreshold- whether to threshold the green paint bufferuseBlueThreshold- whether to threshold the blue paint buffer
-
setThresholds
public void setThresholds(float threshold1, float threshold2) Sets the thresholds.- Parameters:
threshold1- the first thresholdthreshold2- the second threshold
-
showUsingOrientation
public boolean showUsingOrientation(int tSlice, int[] bufferA, int[] bufferB, boolean forceShow, boolean bBlend, float fAlpha, boolean bShowMask) For generating the display of one or two ModelImages (imageA and imageB). Images may be oriented or non-oriented, axis-aligned or diagonal cut plans through the ModelImage volume.- Parameters:
tSlice- t (time) slice to showbufferA- the outbuffer for imageAbufferB- the outbuffer for imageBforceShow- when true the image is re-rendered regardless of whether the slice value displayed or LUT has changed.bBlend- when true bufferA and bufferB are blended togetherfAlpha- the blend factor for blending bufferA and bufferB@bShowMask- when true the surface voxel mask (if any) is blended into the buffer.- Returns:
- boolean to indicate whether or not the show function updated
-
showUsingOrientation
public boolean showUsingOrientation(int tSlice, int[] bufferA, int[] bufferB, boolean forceShow, boolean bShowMask) For generating the display of one or two ModelImages (imageA and imageB). Images may be oriented or non-oriented, axis-aligned or diagonal cut plans through the ModelImage volume.- Parameters:
tSlice- t (time) slice to showbufferA- the outbuffer for imageAbufferB- the outbuffer for imageBforceShow- when true the image is re-rendered regardless of whether the slice value displayed or LUT has changed.bShowMask- when true the surface voxel mask (if any) is blended into the buffer.- Returns:
- boolean to indicate whether or not the show function updated
-
getBufferValue
private float getBufferValue(boolean logMagDisplay, boolean isComplexBuffer, float[] imageBuffer, int ind4) Helper method for calculating complex values. Performing isComplexBuffer and logMagDsplay checks elsewhere improves performance. -
updateSlice
public boolean updateSlice(int newSlice) updates the slice value when the wheel is moved or the page_up, page_down keys are pressed. Does bounds checking and comparison with the current slice value. Sets the new position and updates the triImageFrame.- Parameters:
newSlice- the new slice value- Returns:
- true if the slice is updated and the image should be re-rendered, false otherwise
-
axisAligned
private boolean axisAligned()Determines if a slice is axis-aligned, based on the m_kFourCorners[] four corners of the slice in 3D Model space.- Returns:
- true when the slice is axis-aligned, false otherwise.
-
calcMaxNormColors
calculates the color normalization factors.- Parameters:
kImage- the model image from which the normalization factors are calculatedindex- index for storing one of two colors normalization factors
-
center
private void center()Calculate the volume center in PatientCoordinates and set the z-value for this slice. -
fillImageBuffer
private void fillImageBuffer(int slice, boolean bShowMask) Gets the image data based on the orientation, either AXIAL, CORONAL, SAGITTAL, UNKNOWN_ORIENT, or a diagonal slice if the plane is a diagonal cut-plane through the ModelImage.- Parameters:
slice- data slize
-
getColorMapped
private void getColorMapped(ModelRGB modelRGBT, int[] RGBIndexBuffer, int imageIndex, float[] imageBuffer, int index, WildMagic.LibFoundation.Mathematics.ColorRGBA colorMapped) Get the color from the RGB lookup table:- Parameters:
modelRGBT- the color lookup tableRGBIndexBuffer- the color lookup table index bufferimageIndex- which color normalization factor to useimageBuffer- the imageBuffer the LUT is changingindex- the current imageBuffer pixelcolorMapped- the new color value
-