Segmentation Adaptors

<< Click to Display Table of Contents >>

Navigation:  XStream® HDVR® SDK > Implementation Concepts > Mouse Adaptors >

Segmentation Adaptors

Previous pageReturn to chapter overviewNext page

C++ C++ Java Java .NET .NET

Summary

 

A number of different adaptor classes are available to apply segmentation, region growth, slab manipulation and window level. The IConnectivityAdaptor is used for automatic region growth segmentation of a dataset. The IFHCutAdaptor is used for manual selection of a dataset region for segmentation.

 

A number of different adaptor classes are available to apply segmentation, region growth, slab manipulation and window level. The hdrcConnectivityAdaptor is used for automatic region growth segmentation of a dataset. The hdrcFHCutAdaptor is used for manual selection of a dataset region for segmentation.

 

Connectivity Segmentation Adaptor

 

The IConnectivityAdaptor is used for region growth. It is an automatic connectivity segmentation technique used to select and segment images of specific organs, bones, tissues, or other material types in the dataset. When the user clicks on a point in the dataset, the adaptor calls the IRenderEngineContext::ShootRay() method to identify the selected voxel in the dataset. The IVolumeSegmentationContext::Segment() method is then called to recursively grow the selected region, based on the connectivity parameters set in the IConnectivityAdaptor adaptor.

 

IConnectivityAdaptor::Get/SetConnectivity()

 

These methods get and set the connectivity threshold. Values from -1 to +1 are valid.

 

IConnectivityAdaptor::Get/SetType()

 

These methods get and set the segmentation type. This can be used for positive segmentation (show the selected region) or negative segmentation (hide the selected region).

 

// Create an IConnectivityAdaptor object

IConnectivityAdaptor* pConnectivityAdaptor = NULL;

pLibrary->CreateObject(&CLSID_ConnectivityAdaptor, &pConnectivityAdaptor);

 

// Sets the connectivity threshold.

pConnectivityAdaptor->SetConnectivity(0);

 

// Set the segmentation type to positive or negative.

pConnectivityAdaptor->SetType(SEGMENTATION_TYPE_POSITIVE);

 

// Attach the IConnectivityAdaptor object to a RenderQueue

pConnectivityAdaptor->SetRenderParamsReciever(pRenderQueue);

 

The hdrcConnectivityAdaptor is used for region growth. It is an automatic connectivity segmentation technique used to select and segment images of specific organs, bones, tissues, or other material types in the dataset. When the user clicks on a point in the dataset, the adaptor calls the hdrcRenderEngineContext::shootRay() method to identify the selected voxel in the dataset. The hdrcIVolumeSegmentation::Segment() method is then called to recursively grow the selected region, based on the connectivity parameters set in the hdrcConnectivityAdaptor adaptor.

 

hdrcConnectivityAdaptor::get/setConnectivity()

 

These methods get and set the connectivity threshold. Values from -1 to +1 are valid.

 

hdrcConnectivityAdaptor::get/setType()

 

These methods get and set the segmentation type. This can be used for positive segmentation (show the selected region) or negative segmentation (hide the selected region).

 

// Create a hdcrConnectivityAdaptor object

hdrcConnectivityAdaptor connectivityAdaptor = new hdrcConnectivityAdaptor(renderQueue);

 

// Sets the connectivity threshold.

connectivityAdaptor.setConnectivity(0);

 

// Set the segmentation type to positive or negative.

connectivityAdaptor.setType(hdrcDefines.SEGMENTATION_TYPE_POSITIVE);

 

// Create a hdcrConnectivityAdaptor object

hdrcConnectivityAdaptor connectivityAdaptor = new hdrcConnectivityAdaptor(renderQueue);

 

// Sets the connectivity threshold.

connectivityAdaptor.setConnectivity(0);

 

// Set the segmentation type to positive or negative.

connectivityAdaptor.setType(hdrcDefines.__Fields.SEGMENTATION_TYPE_POSITIVE);

 

Freehand Cut Segmentation Adaptor

 

Segmentation with the IFHCutAdaptor is performed by using the mouse to draw an outline of the region to be segmented. As the user drags the mouse pointer about, the adaptor captures the points drawn by the mouse and passes them to the IVolumeSegmentationContext::FreeHandCut() method. The outlined region is then segmented according to the parameters set by the IFHCutAdaptor::SetCutType() and IFHCutAdaptor::SetType() methods.

 

IFHCutAdaptor::Get/SetCutType()

 

These methods get and set the cut type. The Freehand Cut feature allows three types of cut from the ENUM_FHC_MODE enumeration: FHC_WHOLE_VOLUME, FHC_SURFACE_ONLY, and FHC_FIRST_LAYER. FHC_WHOLE_VOLUME cuts through the whole volume, FHC_SURFACE_ONLY will affect only the topmost perceived surface, FHC_FIRST_LAYER will begin marking cut points when the mouse first intersects a portion of the volume with non-zero opacity and will stop marking cut points when it reaches a region with zero opacity.

 

IFHCutAdaptor::Get/SetType()

 

These methods get and set the segmentation type. This can be used for positive segmentation (show the selected region) or negative segmentation (hide the selected region).

 

IFHCutAdaptor::GetNumDragPoints()

 

This method returns the number of points making up the freehand cut polygon after a region has been selected. This value can then be used to allocate an array for use with the IFHCutAdaptor::GetDragPoints() method.

 

IFHCutAdaptor::GetDragPoints()

 

This method returns as an output parameter an array of points that represent the freehand cut polygon after a region has been selected. The user must pre-allocate this array using the point count returned by the IFHCutAdaptor::GetNumDragPoints() method.

 

// Create an IFHCutAdaptor object

IFHCutAdaptor* pFHCutAdaptor = NULL;

pLibrary->CreateObject(&CLSID_FHCutAdaptor, &pFHCutAdaptor);

 

// Set the segmentation type to positive or negative.

pFHCutAdaptor->SetCutType(FHC_WHOLE_VOLUME);

 

// Set the segmentation type to positive or negative.

pFHCutAdaptor->SetType(SEGMENTATION_TYPE_POSITIVE);

 

// Attach the IFHCutAdaptor object to a RenderQueue

pFHCutAdaptor->SetRenderParamsReciever(pRenderQueue);

 

///////////////////////////////////////////////////////////

// Elsewhere in code, after cut region has been selected...

///////////////////////////////////////////////////////////

 

// Get the number of control points outlining the selected region.

int numPoints = pFHCutAdaptor->GetNumDragPoints();

 

// Allocate an array of POINT structures to store control points.

POINT controlPoints[] = new POINT[numPoints];

 

// Get array of control points

pFHCutAdaptor->GetDragPoints(controlPoints);

 

Segmentation with the hdrcFHCutAdaptor is performed by using the mouse to draw an outline of the region to be segmented. As the user drags the mouse pointer about, the adaptor captures the points drawn by the mouse and passes them to the hdrcIVolumeSegmentation::FreeHandCut() method. The outlined region is then segmented according to the parameters set by the hdrcFHCutAdaptor::setCutType() and hdrcFHCutAdaptor::setType() methods.

 

IFHCutAdaptor::get/setCutType()

 

These methods get and set the cut type. The Freehand Cut feature allows three types of cut from the ENUM_FHC_MODE enumeration: FHC_WHOLE_VOLUME, FHC_SURFACE_ONLY, and FHC_FIRST_LAYER. FHC_WHOLE_VOLUME cuts through the whole volume, FHC_SURFACE_ONLY will affect only the topmost perceived surface, FHC_FIRST_LAYER will begin marking cut points when the mouse first intersects a portion of the volume with non-zero opacity and will stop marking cut points when it reaches a region with zero opacity.

 

IFHCutAdaptor::get/setType()

 

These methods get and set the segmentation type. This can be used for positive segmentation (show the selected region) or negative segmentation (hide the selected region).

 

IFHCutAdaptor::getCurrentDragPoints()

 

This method returns a vector of points representing the freehand cut polygon after a region has been selected.

 

// Create a hdrcFHCutAdaptor object

hdrcFHCutAdaptor fhCutAdaptor = new hdrcFHCutAdaptor(renderQueue);

 

// Set the segmentation type to positive or negative.

fhCutAdaptor.setCutType(hdrcDefines.FHC_WHOLE_VOLUME);

 

// Set the segmentation type to positive or negative.

fhCutAdaptor.setType(hdrcDefines.SEGMENTATION_TYPE_POSITIVE);

 

///////////////////////////////////////////////////////////

// Elsewhere in code, after cut region has been selected...

///////////////////////////////////////////////////////////

 

// Get vector of control points

vector<POINT> controlPoints = fhCutAdaptor.getCurrentDragPoints();

 

// Create a hdrcFHCutAdaptor object

hdrcFHCutAdaptor fhCutAdaptor = new hdrcFHCutAdaptor(renderQueue);

 

// Set the segmentation type to positive or negative.

fhCutAdaptor.setCutType(hdrcDefines.__Fields.FHC_WHOLE_VOLUME);

 

// Set the segmentation type to positive or negative.

fhCutAdaptor.setType(hdrcDefines.__Fields.SEGMENTATION_TYPE_POSITIVE);

 

///////////////////////////////////////////////////////////

// Elsewhere in code, after cut region has been selected...

///////////////////////////////////////////////////////////

 

// Get vector of control points

vector<POINT> controlPoints = fhCutAdaptor.getCurrentDragPoints();