本文整理汇总了C++中datanode::Pointer::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetData方法的具体用法?C++ Pointer::GetData怎么用?C++ Pointer::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datanode::Pointer
的用法示例。
在下文中一共展示了Pointer::GetData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
mitk::TestDICOMLoading::ImageList mitk::TestDICOMLoading::LoadFiles( const StringContainer& files )
{
for (StringContainer::const_iterator iter = files.begin();
iter != files.end();
++iter)
{
MITK_DEBUG << "File " << *iter;
}
ImageList result;
DicomSeriesReader::FileNamesGrouping seriesInFiles = DicomSeriesReader::GetSeries( files, true );
// TODO sort series UIDs, implementation of map iterator might differ on different platforms (or verify this is a standard topic??)
for (DicomSeriesReader::FileNamesGrouping::const_iterator seriesIter = seriesInFiles.begin();
seriesIter != seriesInFiles.end();
++seriesIter)
{
StringContainer files = seriesIter->second.GetFilenames();
DataNode::Pointer node = DicomSeriesReader::LoadDicomSeries( files );
if (node.IsNotNull())
{
Image::Pointer image = dynamic_cast<mitk::Image*>( node->GetData() );
result.push_back( image );
}
else
{
}
}
return result;
}
示例2: GetTargetSegmentationNode
void mitk::BinaryThresholdULTool::CreateNewSegmentationFromThreshold(DataNode* node)
{
if (node)
{
Image::Pointer feedBackImage = dynamic_cast<Image*>( m_ThresholdFeedbackNode->GetData() );
if (feedBackImage.IsNotNull())
{
// create a new image of the same dimensions and smallest possible pixel type
DataNode::Pointer emptySegmentation = GetTargetSegmentationNode();
if (emptySegmentation)
{
// actually perform a thresholding and ask for an organ type
for (unsigned int timeStep = 0; timeStep < feedBackImage->GetTimeSteps(); ++timeStep)
{
try
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( feedBackImage );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer feedBackImage3D = timeSelector->GetOutput();
if (feedBackImage3D->GetDimension() == 2)
{
AccessFixedDimensionByItk_2( feedBackImage3D, ITKSetVolume, 2, dynamic_cast<Image*>(emptySegmentation->GetData()), timeStep );
}
else
{
AccessFixedDimensionByItk_2( feedBackImage3D, ITKSetVolume, 3, dynamic_cast<Image*>(emptySegmentation->GetData()), timeStep );
}
}
catch(...)
{
Tool::ErrorMessage("Error accessing single time steps of the original image. Cannot create segmentation.");
}
}
//since we are maybe working on a smaller image, pad it to the size of the original image
if (m_OriginalImageNode.GetPointer() != m_NodeForThresholding.GetPointer())
{
mitk::PadImageFilter::Pointer padFilter = mitk::PadImageFilter::New();
padFilter->SetInput(0, dynamic_cast<mitk::Image*> (emptySegmentation->GetData()));
padFilter->SetInput(1, dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData()));
padFilter->SetBinaryFilter(true);
padFilter->SetUpperThreshold(1);
padFilter->SetLowerThreshold(1);
padFilter->Update();
emptySegmentation->SetData(padFilter->GetOutput());
}
m_ToolManager->SetWorkingData( emptySegmentation );
m_ToolManager->GetWorkingData(0)->Modified();
}
}
}
}
示例3: catch
void mitk::BinaryThresholdULTool::CreateNewSegmentationFromThreshold(DataNode* node, const std::string& organName, const Color& color)
{
if (node)
{
Image::Pointer image = dynamic_cast<Image*>( m_NodeForThresholding->GetData() );
if (image.IsNotNull())
{
// create a new image of the same dimensions and smallest possible pixel type
DataNode::Pointer emptySegmentation = Tool::CreateEmptySegmentationNode( image, organName, color );
if (emptySegmentation)
{
// actually perform a thresholding and ask for an organ type
for (unsigned int timeStep = 0; timeStep < image->GetTimeSteps(); ++timeStep)
{
try
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( image );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer image3D = timeSelector->GetOutput();
AccessFixedDimensionByItk_2( image3D, ITKThresholding, 3, dynamic_cast<Image*>(emptySegmentation->GetData()), timeStep );
}
catch(...)
{
Tool::ErrorMessage("Error accessing single time steps of the original image. Cannot create segmentation.");
}
}
//since we are maybe working on a smaller image, pad it to the size of the original image
if (m_OriginalImageNode.GetPointer() != m_NodeForThresholding.GetPointer())
{
mitk::PadImageFilter::Pointer padFilter = mitk::PadImageFilter::New();
padFilter->SetInput(0, dynamic_cast<mitk::Image*> (emptySegmentation->GetData()));
padFilter->SetInput(1, dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData()));
padFilter->SetBinaryFilter(true);
padFilter->SetUpperThreshold(1);
padFilter->SetLowerThreshold(1);
padFilter->Update();
emptySegmentation->SetData(padFilter->GetOutput());
}
if (DataStorage* ds = m_ToolManager->GetDataStorage())
{
ds->Add( emptySegmentation, m_OriginalImageNode );
}
m_ToolManager->SetWorkingData( emptySegmentation );
}
}
}
}
示例4:
void mitk::PlanarFigureInteractor::AddPoint(StateMachineAction*, InteractionEvent* interactionEvent)
{
const mitk::InteractionPositionEvent* positionEvent = dynamic_cast<mitk::InteractionPositionEvent*>( interactionEvent );
if ( positionEvent == nullptr )
return;
const DataNode::Pointer node = this->GetDataNode();
const BaseData::Pointer data = node->GetData();
/*
* Added check for "initiallyplaced" due to bug 13097:
*
* There are two possible cases in which a point can be inserted into a PlanarPolygon:
*
* 1. The figure is currently drawn -> the point will be appended at the end of the figure
* 2. A point is inserted at a userdefined position after the initial placement of the figure is finished
*
* In the second case we need to determine the proper insertion index. In the first case the index always has
* to be -1 so that the point is appended to the end.
*
* These changes are necessary because of a mac os x specific issue: If a users draws a PlanarPolygon then the
* next point to be added moves according to the mouse position. If then the user left clicks in order to add
* a point one would assume the last move position is identical to the left click position. This is actually the
* case for windows and linux but somehow NOT for mac. Because of the insertion logic of a new point in the
* PlanarFigure then for mac the wrong current selected point is determined.
*
* With this check here this problem can be avoided. However a redesign of the insertion logic should be considered
*/
bool isFigureFinished = false;
data->GetPropertyList()->GetBoolProperty("initiallyplaced", isFigureFinished);
bool selected = false;
bool isEditable = true;
node->GetBoolProperty("selected", selected);
node->GetBoolProperty("planarfigure.iseditable", isEditable);
if ( !selected || !isEditable )
{
return;
}
mitk::PlanarFigure *planarFigure = dynamic_cast<mitk::PlanarFigure *>(data.GetPointer());
// We can't derive a new control point from a polyline of a Bezier curve
// as all control points contribute to each polyline point.
if (dynamic_cast<PlanarBezierCurve*>(planarFigure) != nullptr && isFigureFinished)
return;
const mitk::PlaneGeometry *planarFigureGeometry = planarFigure->GetPlaneGeometry();
const mitk::AbstractTransformGeometry *abstractTransformGeometry =
dynamic_cast< AbstractTransformGeometry * >( planarFigure->GetGeometry( 0 ) );
if ( abstractTransformGeometry != nullptr)
return;
// If the planarFigure already has reached the maximum number
if ( planarFigure->GetNumberOfControlPoints() >= planarFigure->GetMaximumNumberOfControlPoints() )
{
return;
}
// Extract point in 2D world coordinates (relative to PlaneGeometry of
// PlanarFigure)
Point2D point2D, projectedPoint;
if ( !this->TransformPositionEventToPoint2D( positionEvent, planarFigureGeometry, point2D ) )
{
return;
}
// TODO: check segment of polyline we clicked in
int nextIndex = -1;
// We only need to check which position to insert the control point
// when interacting with a PlanarPolygon. For all other types
// new control points will always be appended
const mitk::BaseRenderer *renderer = interactionEvent->GetSender();
const PlaneGeometry *projectionPlane = renderer->GetCurrentWorldPlaneGeometry();
if (dynamic_cast<mitk::PlanarPolygon*>(planarFigure) && isFigureFinished)
{
nextIndex = this->IsPositionOverFigure(
positionEvent,
planarFigure,
planarFigureGeometry,
projectionPlane,
projectedPoint
);
}
// Add point as new control point
if ( planarFigure->IsPreviewControlPointVisible() )
{
point2D = planarFigure->GetPreviewControlPoint();
}
//.........这里部分代码省略.........
示例5: Run
void QmitkCreatePolygonModelAction::Run(const QList<DataNode::Pointer> &selectedNodes)
{
DataNode::Pointer selectedNode = selectedNodes[0];
Image::Pointer image = dynamic_cast<mitk::Image *>(selectedNode->GetData());
if (image.IsNull())
{
return;
}
try
{
// Get preference properties for smoothing and decimation
IPreferencesService::Pointer prefService = Platform::GetServiceRegistry().GetServiceById<IPreferencesService>(IPreferencesService::ID);
IPreferences::Pointer segPref = prefService->GetSystemPreferences()->Node("/org.mitk.views.segmentation");
bool smoothingHint = segPref->GetBool("smoothing hint", true);
ScalarType smoothing = segPref->GetDouble("smoothing value", 1.0);
ScalarType decimation = segPref->GetDouble("decimation rate", 0.5);
if (smoothingHint)
{
smoothing = 0.0;
Vector3D spacing = image->GetGeometry()->GetSpacing();
for (Vector3D::Iterator iter = spacing.Begin(); iter != spacing.End(); ++iter)
smoothing = max(smoothing, *iter);
}
ShowSegmentationAsSurface::Pointer surfaceFilter = ShowSegmentationAsSurface::New();
// Activate callback functions
itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::Pointer successCommand = itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::New();
successCommand->SetCallbackFunction(this, &QmitkCreatePolygonModelAction::OnSurfaceCalculationDone);
surfaceFilter->AddObserver(ResultAvailable(), successCommand);
itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::Pointer errorCommand = itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::New();
errorCommand->SetCallbackFunction(this, &QmitkCreatePolygonModelAction::OnSurfaceCalculationDone);
surfaceFilter->AddObserver(ProcessingError(), errorCommand);
// set filter parameter
surfaceFilter->SetDataStorage(*m_DataStorage);
surfaceFilter->SetPointerParameter("Input", image);
surfaceFilter->SetPointerParameter("Group node", selectedNode);
surfaceFilter->SetParameter("Show result", true);
surfaceFilter->SetParameter("Sync visibility", false);
surfaceFilter->SetParameter("Median kernel size", 3u);
surfaceFilter->SetParameter("Decimate mesh", m_IsDecimated);
surfaceFilter->SetParameter("Decimation rate", (float) decimation);
if (m_IsSmoothed)
{
surfaceFilter->SetParameter("Apply median", true);
surfaceFilter->SetParameter("Smooth", true);
surfaceFilter->SetParameter("Gaussian SD", sqrtf(smoothing)); // use sqrt to account for setting of variance in preferences
StatusBar::GetInstance()->DisplayText("Smoothed surface creation started in background...");
}
else
{
surfaceFilter->SetParameter("Apply median", false);
surfaceFilter->SetParameter("Smooth", false);
StatusBar::GetInstance()->DisplayText("Surface creation started in background...");
}
surfaceFilter->StartAlgorithm();
}
catch(...)
{
MITK_ERROR << "Surface creation failed!";
}
}
示例6: Run
void QmitkCreatePolygonModelAction::Run(const QList<DataNode::Pointer> &selectedNodes)
{
DataNode::Pointer selectedNode = selectedNodes[0];
Image::Pointer image = dynamic_cast<mitk::Image *>(selectedNode->GetData());
if (image.IsNull())
return;
try
{
if (!m_IsSmoothed)
{
ShowSegmentationAsSurface::Pointer surfaceFilter = ShowSegmentationAsSurface::New();
itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::Pointer successCommand = itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::New();
successCommand->SetCallbackFunction(this, &QmitkCreatePolygonModelAction::OnSurfaceCalculationDone);
surfaceFilter->AddObserver(ResultAvailable(), successCommand);
itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::Pointer errorCommand = itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::New();
errorCommand->SetCallbackFunction(this, &QmitkCreatePolygonModelAction::OnSurfaceCalculationDone);
surfaceFilter->AddObserver(ProcessingError(), errorCommand);
surfaceFilter->SetDataStorage(*m_DataStorage);
surfaceFilter->SetPointerParameter("Input", image);
surfaceFilter->SetPointerParameter("Group node", selectedNode);
surfaceFilter->SetParameter("Show result", true);
surfaceFilter->SetParameter("Sync visibility", false);
surfaceFilter->SetParameter("Smooth", false);
surfaceFilter->SetParameter("Apply median", false);
surfaceFilter->SetParameter("Median kernel size", 3u);
surfaceFilter->SetParameter("Gaussian SD", 1.5f);
surfaceFilter->SetParameter("Decimate mesh", m_IsDecimated);
surfaceFilter->SetParameter("Decimation rate", 0.8f);
StatusBar::GetInstance()->DisplayText("Surface creation started in background...");
surfaceFilter->StartAlgorithm();
}
else
{
ShowSegmentationAsSmoothedSurface::Pointer surfaceFilter = ShowSegmentationAsSmoothedSurface::New();
itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::Pointer successCommand = itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::New();
successCommand->SetCallbackFunction(this, &QmitkCreatePolygonModelAction::OnSurfaceCalculationDone);
surfaceFilter->AddObserver(mitk::ResultAvailable(), successCommand);
itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::Pointer errorCommand = itk::SimpleMemberCommand<QmitkCreatePolygonModelAction>::New();
errorCommand->SetCallbackFunction(this, &QmitkCreatePolygonModelAction::OnSurfaceCalculationDone);
surfaceFilter->AddObserver(mitk::ProcessingError(), errorCommand);
surfaceFilter->SetDataStorage(*m_DataStorage);
surfaceFilter->SetPointerParameter("Input", image);
surfaceFilter->SetPointerParameter("Group node", selectedNode);
berry::IWorkbenchPart::Pointer activePart =
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->GetActivePart();
mitk::IRenderWindowPart* renderPart = dynamic_cast<mitk::IRenderWindowPart*>(activePart.GetPointer());
mitk::SliceNavigationController* timeNavController = 0;
if (renderPart != 0)
{
timeNavController = renderPart->GetRenderingManager()->GetTimeNavigationController();
}
int timeNr = timeNavController != 0 ? timeNavController->GetTime()->GetPos() : 0;
surfaceFilter->SetParameter("TimeNr", timeNr);
IPreferencesService::Pointer prefService = Platform::GetServiceRegistry().GetServiceById<IPreferencesService>(IPreferencesService::ID);
IPreferences::Pointer segPref = prefService->GetSystemPreferences()->Node("/org.mitk.views.segmentation");
bool smoothingHint = segPref->GetBool("smoothing hint", true);
float smoothing = (float)segPref->GetDouble("smoothing value", 1.0);
float decimation = (float)segPref->GetDouble("decimation rate", 0.5);
float closing = (float)segPref->GetDouble("closing ratio", 0.0);
if (smoothingHint)
{
smoothing = 0.0;
Vector3D spacing = image->GetGeometry()->GetSpacing();
for (Vector3D::Iterator iter = spacing.Begin(); iter != spacing.End(); ++iter)
smoothing = max(smoothing, *iter);
}
surfaceFilter->SetParameter("Smoothing", smoothing);
surfaceFilter->SetParameter("Decimation", decimation);
surfaceFilter->SetParameter("Closing", closing);
ProgressBar::GetInstance()->AddStepsToDo(8);
StatusBar::GetInstance()->DisplayText("Smoothed surface creation started in background...");
try {
surfaceFilter->StartAlgorithm();
} catch (...)
{
MITK_ERROR<<"Error creating smoothed polygon model: Not enough memory!";
}
}
}
catch(...)
{
//.........这里部分代码省略.........
示例7: localeSwitch
std::vector<itk::SmartPointer<BaseData> > BaseDICOMReaderService::Read()
{
std::vector<BaseData::Pointer> result;
//special handling of Philips 3D US DICOM.
//Copied from DICOMSeriesReaderService
std::string fileName = this->GetLocalFileName();
if (DicomSeriesReader::IsPhilips3DDicom(fileName))
{
MITK_INFO << "it is a Philips3D US Dicom file" << std::endl;
mitk::LocaleSwitch localeSwitch("C");
std::locale previousCppLocale(std::cin.getloc());
std::locale l("C");
std::cin.imbue(l);
DataNode::Pointer node = DataNode::New();
mitk::DicomSeriesReader::StringContainer stringvec;
stringvec.push_back(fileName);
if (DicomSeriesReader::LoadDicomSeries(stringvec, *node))
{
BaseData::Pointer data = node->GetData();
StringProperty::Pointer nameProp = StringProperty::New(itksys::SystemTools::GetFilenameName(fileName));
data->GetPropertyList()->SetProperty("name", nameProp);
result.push_back(data);
}
std::cin.imbue(previousCppLocale);
return result;
}
//Normal DICOM handling (It wasn't a Philips 3D US)
mitk::StringList relevantFiles = this->GetRelevantFiles();
mitk::DICOMFileReader::Pointer reader = this->GetReader(relevantFiles);
reader->SetAdditionalTagsOfInterest(mitk::GetCurrentDICOMTagsOfInterest());
reader->SetTagLookupTableToPropertyFunctor(mitk::GetDICOMPropertyForDICOMValuesFunctor);
reader->SetInputFiles(relevantFiles);
reader->AnalyzeInputFiles();
reader->LoadImages();
for (unsigned int i = 0; i < reader->GetNumberOfOutputs(); ++i)
{
const mitk::DICOMImageBlockDescriptor& desc = reader->GetOutput(i);
mitk::BaseData::Pointer data = desc.GetMitkImage().GetPointer();
std::string nodeName = "Unnamed_DICOM";
std::string studyDescription = desc.GetPropertyAsString("studyDescription");
std::string seriesDescription = desc.GetPropertyAsString("seriesDescription");
if (!studyDescription.empty())
{
nodeName = studyDescription;
}
if (!seriesDescription.empty())
{
if (!studyDescription.empty())
{
nodeName += "/";
}
nodeName += seriesDescription;
}
StringProperty::Pointer nameProp = StringProperty::New(nodeName);
data->SetProperty("name", nameProp);
result.push_back(data);
}
return result;
}
示例8: error
bool mitk::SceneReaderV1::LoadScene( TiXmlDocument& document, const std::string& workingDirectory, DataStorage* storage )
{
assert(storage);
bool error(false);
// TODO prepare to detect errors (such as cycles) from wrongly written or edited xml files
//Get number of elements to initialze progress bar
unsigned int listSize = 0;
for( TiXmlElement* element = document.FirstChildElement("node"); element != NULL; element = element->NextSiblingElement("node") )
{
++listSize;
}
ProgressBar::GetInstance()->AddStepsToDo( listSize );
// iterate all nodes
// first level nodes should be <node> elements
for( TiXmlElement* element = document.FirstChildElement("node"); element != NULL; element = element->NextSiblingElement("node") )
{
// 1. if there is a <data type="..." file="..."> element,
// - construct a name for the appropriate serializer
// - try to instantiate this serializer via itk object factory
// - if serializer could be created, use it to read the file into a BaseData object
// - if successful, call the new node's SetData(..)
DataNode::Pointer node = LoadBaseDataFromDataTag( element->FirstChildElement("data"), workingDirectory, error );
// create a node for the tag "data" and test if node was created
// in case dataXmlElement is valid test whether it containts the "properties" child tag
// and process further if and only if yes
TiXmlElement *dataXmlElement = element->FirstChildElement("data");
if( dataXmlElement && dataXmlElement->FirstChildElement("properties") )
{
TiXmlElement *baseDataElement = dataXmlElement->FirstChildElement("properties");
if ( node->GetData() )
{
DecorateBaseDataWithProperties( node->GetData(), baseDataElement, workingDirectory);
}
else
{
MITK_WARN << "BaseData properties stored in scene file, but BaseData can't be read" << std::endl;
}
}
// 2. check child nodes
const char* uida = element->Attribute("UID");
std::string uid("");
if (uida)
{
uid = uida;
m_NodeForID[uid] = node.GetPointer();
m_IDForNode[ node.GetPointer() ] = uid;
}
else
{
MITK_ERROR << "No UID found for current node. Node will have no parents.";
error = true;
}
// remember node for later adding to DataStorage
m_Nodes.insert( std::make_pair( node, std::list<std::string>() ) );
// 3. if there are <source> elements, remember parent objects
for( TiXmlElement* source = element->FirstChildElement("source"); source != NULL; source = source->NextSiblingElement("source") )
{
const char* sourceUID = source->Attribute("UID");
if (sourceUID)
{
m_Nodes[node].push_back( std::string(sourceUID) );
}
}
// 5. if there are <properties> nodes,
// - instantiate the appropriate PropertyListDeSerializer
// - use them to construct PropertyList objects
// - add these properties to the node (if necessary, use renderwindow name)
bool success = DecorateNodeWithProperties(node, element, workingDirectory);
if (!success)
{
MITK_ERROR << "Could not load properties for node.";
error = true;
}
ProgressBar::GetInstance()->Progress();
} // end for all <node>
// remove all unknown parent UIDs
for (NodesAndParentsMapType::iterator nodesIter = m_Nodes.begin();
nodesIter != m_Nodes.end();
++nodesIter)
{
for (std::list<std::string>::iterator parentsIter = nodesIter->second.begin();
parentsIter != nodesIter->second.end();)
{
if (m_NodeForID.find( *parentsIter ) == m_NodeForID.end())
{
parentsIter = nodesIter->second.erase( parentsIter );
//.........这里部分代码省略.........
示例9: GetDataNode
void mitk::BoundingShapeVtkMapper2D::GenerateDataForRenderer(BaseRenderer *renderer)
{
const DataNode::Pointer node = GetDataNode();
if (node == nullptr)
return;
LocalStorage *localStorage = m_Impl->LocalStorageHandler.GetLocalStorage(renderer);
// either update if GeometryData was modified or if the zooming was performed
bool needGenerateData = localStorage->IsUpdateRequired(
renderer, this, GetDataNode()); // true; // localStorage->GetLastGenerateDataTime() < node->GetMTime() ||
// localStorage->GetLastGenerateDataTime() < node->GetData()->GetMTime();
// //localStorage->IsGenerateDataRequired(renderer, this, GetDataNode());
double scale = renderer->GetScaleFactorMMPerDisplayUnit();
if (std::abs(scale - localStorage->m_ZoomFactor) > 0.001)
{
localStorage->m_ZoomFactor = scale;
needGenerateData = true;
}
if (needGenerateData)
{
bool visible = true;
GetDataNode()->GetVisibility(visible, renderer, "visible");
if (!visible)
{
localStorage->m_Actor->VisibilityOff();
return;
}
GeometryData::Pointer shape = static_cast<GeometryData *>(node->GetData());
if (shape == nullptr)
return;
mitk::BaseGeometry::Pointer geometry = shape->GetGeometry();
mitk::Vector3D spacing = geometry->GetSpacing();
// calculate cornerpoints and extent from geometry with visualization offset
std::vector<Point3D> cornerPoints = GetCornerPoints(geometry, true);
Point3D p0 = cornerPoints[0];
Point3D p1 = cornerPoints[1];
Point3D p2 = cornerPoints[2];
Point3D p4 = cornerPoints[4];
Point3D extent;
extent[0] =
sqrt((p0[0] - p4[0]) * (p0[0] - p4[0]) + (p0[1] - p4[1]) * (p0[1] - p4[1]) + (p0[2] - p4[2]) * (p0[2] - p4[2]));
extent[1] =
sqrt((p0[0] - p2[0]) * (p0[0] - p2[0]) + (p0[1] - p2[1]) * (p0[1] - p2[1]) + (p0[2] - p2[2]) * (p0[2] - p2[2]));
extent[2] =
sqrt((p0[0] - p1[0]) * (p0[0] - p1[0]) + (p0[1] - p1[1]) * (p0[1] - p1[1]) + (p0[2] - p1[2]) * (p0[2] - p1[2]));
// calculate center based on half way of the distance between two opposing cornerpoints
mitk::Point3D center = CalcAvgPoint(cornerPoints[7], cornerPoints[0]);
if (m_Impl->HandlePropertyList.size() == 6)
{
// set handle positions
Point3D pointLeft = CalcAvgPoint(cornerPoints[5], cornerPoints[6]);
Point3D pointRight = CalcAvgPoint(cornerPoints[1], cornerPoints[2]);
Point3D pointTop = CalcAvgPoint(cornerPoints[0], cornerPoints[6]);
Point3D pointBottom = CalcAvgPoint(cornerPoints[7], cornerPoints[1]);
Point3D pointFront = CalcAvgPoint(cornerPoints[2], cornerPoints[7]);
Point3D pointBack = CalcAvgPoint(cornerPoints[4], cornerPoints[1]);
m_Impl->HandlePropertyList[0].SetPosition(pointLeft);
m_Impl->HandlePropertyList[1].SetPosition(pointRight);
m_Impl->HandlePropertyList[2].SetPosition(pointTop);
m_Impl->HandlePropertyList[3].SetPosition(pointBottom);
m_Impl->HandlePropertyList[4].SetPosition(pointFront);
m_Impl->HandlePropertyList[5].SetPosition(pointBack);
}
// caculate face normals
double result0[3], result1[3], result2[3];
double a[3], b[3];
a[0] = (cornerPoints[5][0] - cornerPoints[6][0]);
a[1] = (cornerPoints[5][1] - cornerPoints[6][1]);
a[2] = (cornerPoints[5][2] - cornerPoints[6][2]);
b[0] = (cornerPoints[5][0] - cornerPoints[4][0]);
b[1] = (cornerPoints[5][1] - cornerPoints[4][1]);
b[2] = (cornerPoints[5][2] - cornerPoints[4][2]);
vtkMath::Cross(a, b, result0);
a[0] = (cornerPoints[0][0] - cornerPoints[6][0]);
a[1] = (cornerPoints[0][1] - cornerPoints[6][1]);
a[2] = (cornerPoints[0][2] - cornerPoints[6][2]);
b[0] = (cornerPoints[0][0] - cornerPoints[2][0]);
b[1] = (cornerPoints[0][1] - cornerPoints[2][1]);
b[2] = (cornerPoints[0][2] - cornerPoints[2][2]);
vtkMath::Cross(a, b, result1);
a[0] = (cornerPoints[2][0] - cornerPoints[7][0]);
a[1] = (cornerPoints[2][1] - cornerPoints[7][1]);
a[2] = (cornerPoints[2][2] - cornerPoints[7][2]);
//.........这里部分代码省略.........