C# Class ClearCanvas.ImageViewer.RoiGraphics.Roi

Represents a static region of interest for the purposes of computing statistics on the contained pixels.

Roi objects are static definitions of a region of interest on a particular image. Its shape definition and the underlying pixel values are considered fixed upon construction, and hence its various properties and statistics are non-changing.

New instances of a Roi should be constructed everytime the definition of the region of interest or the underlying image pixel data has changed. The IGraphic.GetRoi method allows client code to quickly construct a new instance of a Roi based on the current definition of the graphic and the image it currently belongs to.

显示文件 Open project: jasper-yeh/ClearCanvas Class Usage Examples

Public Methods

Method Description
Contains ( PointF point ) : bool

Tests to see if the given point is contained within the region of interest.

Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)

Contains ( float x, float y ) : bool

Tests to see if the given point is contained within the region of interest.

Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)

Contains ( int x, int y ) : bool

Tests to see if the given point is contained within the region of interest.

Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)

CopyTo ( IPresentationImage presentationImage ) : Roi

Creates a copy of this Roi using the same region of interest shape but using a different image as the source pixel data.

GetBoundingBoxRounded ( bool constrainToImage ) : Rectangle

Returns a bounding box that has been rounded to the nearest whole pixel(s).

Uses RectangleUtilities.RoundInflate to ensure the bounding box returned will encompass every pixel that is inside the ROI.

GetPixelCoordinates ( ) : IEnumerable

Gets an enumeration of the coordinates of points contained within the region of interest.

Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)

GetPixelValues ( ) : IEnumerable

Gets an enumeration of the modality LUT transformed pixel values contained within the region of interest rounded to the nearest integer.

If the ModalityLut is null, then this method enumerates the same values as GetRawPixelValues.

GetRawPixelValues ( ) : IEnumerable

Gets an enumeration of the raw pixel values contained within the region of interest.

Protected Methods

Method Description
ComputeBounds ( ) : RectangleF

Called by BoundingBox to compute the tightest bounding box of the region of interest.

This method is only called once and the result is cached for future accesses.

Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)

ConvertFromSquarePixels ( double area, ClearCanvas.Dicom.Iod.Units units, PixelSpacing pixelSpacing ) : double

Converts an area in pixels into the given units given some particular pixel spacing.

Roi ( IPresentationImage presentationImage ) : System

Constructs a new region of interest, specifying an IPresentationImage as the source of the pixel data.

ValidateUnits ( ClearCanvas.Dicom.Iod.Units units, PixelSpacing pixelSpacing ) : bool

Checks if operations in the given units are possible with the pixelSpacing information available.

Private Methods

Method Description
IsBoundingBoxInImage ( ) : bool

Checks whether or not the region of interest's bounding box intersects the image.

Method Details

ComputeBounds() protected abstract method

Called by BoundingBox to compute the tightest bounding box of the region of interest.

This method is only called once and the result is cached for future accesses.

Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)

protected abstract ComputeBounds ( ) : RectangleF
return System.Drawing.RectangleF

Contains() public abstract method

Tests to see if the given point is contained within the region of interest.
Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)
public abstract Contains ( PointF point ) : bool
point System.Drawing.PointF The point to test.
return bool

Contains() public method

Tests to see if the given point is contained within the region of interest.
Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)
public Contains ( float x, float y ) : bool
x float The X-coordinate of the point to test.
y float The Y-coordinate of the point to test.
return bool

Contains() public method

Tests to see if the given point is contained within the region of interest.
Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)
public Contains ( int x, int y ) : bool
x int The X-coordinate of the point to test.
y int The Y-coordinate of the point to test.
return bool

ConvertFromSquarePixels() protected static method

Converts an area in pixels into the given units given some particular pixel spacing.
Thrown if is a physical unit of measurement and is not calibrated.
protected static ConvertFromSquarePixels ( double area, ClearCanvas.Dicom.Iod.Units units, PixelSpacing pixelSpacing ) : double
area double The area of pixels to be converted.
units ClearCanvas.Dicom.Iod.Units The units into which the area should be converted.
pixelSpacing PixelSpacing The pixel spacing information available.
return double

CopyTo() public abstract method

Creates a copy of this Roi using the same region of interest shape but using a different image as the source pixel data.
public abstract CopyTo ( IPresentationImage presentationImage ) : Roi
presentationImage IPresentationImage The image upon which to copy this region of interest.
return Roi

GetBoundingBoxRounded() public method

Returns a bounding box that has been rounded to the nearest whole pixel(s).
Uses RectangleUtilities.RoundInflate to ensure the bounding box returned will encompass every pixel that is inside the ROI.
public GetBoundingBoxRounded ( bool constrainToImage ) : Rectangle
constrainToImage bool Whether or not the returned rectangle should also be constrained to the image bounds.
return System.Drawing.Rectangle

GetPixelCoordinates() public method

Gets an enumeration of the coordinates of points contained within the region of interest.
Regions of interest have no notion of coordinate system. All coordinates are inherently given relative to the image pixel space (i.e. CoordinateSystem.Source.)
public GetPixelCoordinates ( ) : IEnumerable
return IEnumerable

GetPixelValues() public method

Gets an enumeration of the modality LUT transformed pixel values contained within the region of interest rounded to the nearest integer.
If the ModalityLut is null, then this method enumerates the same values as GetRawPixelValues.
public GetPixelValues ( ) : IEnumerable
return IEnumerable

GetRawPixelValues() public method

Gets an enumeration of the raw pixel values contained within the region of interest.
public GetRawPixelValues ( ) : IEnumerable
return IEnumerable

Roi() protected method

Constructs a new region of interest, specifying an IPresentationImage as the source of the pixel data.
protected Roi ( IPresentationImage presentationImage ) : System
presentationImage IPresentationImage The image containing the source pixel data.
return System

ValidateUnits() protected static method

Checks if operations in the given units are possible with the pixelSpacing information available.
protected static ValidateUnits ( ClearCanvas.Dicom.Iod.Units units, PixelSpacing pixelSpacing ) : bool
units ClearCanvas.Dicom.Iod.Units
pixelSpacing PixelSpacing
return bool