本文整理汇总了C++中baserenderer::Pointer::IsNotNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::IsNotNull方法的具体用法?C++ Pointer::IsNotNull怎么用?C++ Pointer::IsNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类baserenderer::Pointer
的用法示例。
在下文中一共展示了Pointer::IsNotNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool mitk::AffineDataInteractor3D::ColorizeSurface(BaseRenderer::Pointer renderer, double scalar)
{
BaseData::Pointer data = this->GetDataNode()->GetData();
if(data.IsNull())
{
MITK_ERROR << "AffineInteractor3D: No data object present!";
return false;
}
// Get the timestep to also support 3D+t
int timeStep = 0;
if (renderer.IsNotNull())
timeStep = renderer->GetTimeStep(data);
// If data is an mitk::Surface, extract it
Surface::Pointer surface = dynamic_cast< Surface* >(data.GetPointer());
vtkPolyData* polyData = NULL;
if (surface.IsNotNull())
polyData = surface->GetVtkPolyData(timeStep);
if (polyData == NULL)
{
MITK_ERROR << "AffineInteractor3D: No poly data present!";
return false;
}
vtkPointData* pointData = polyData->GetPointData();
if (pointData == NULL)
{
MITK_ERROR << "AffineInteractor3D: No point data present!";
return false;
}
vtkDataArray* scalars = pointData->GetScalars();
if (scalars == NULL)
{
MITK_ERROR << "AffineInteractor3D: No scalars for point data present!";
return false;
}
for (unsigned int i = 0; i < pointData->GetNumberOfTuples(); ++i)
{
scalars->SetComponent(i, 0, scalar);
}
polyData->Modified();
pointData->Update();
return true;
}
示例2: cname
void Geometry2DDataVtkMapper3D::ProcessNode( DataNode * node, BaseRenderer* renderer,
Surface * surface, LayerSortedActorList &layerSortedActors )
{
if ( node != NULL )
{
//we need to get the information from the 2D mapper to render the texture on the 3D plane
ImageVtkMapper2D *imageMapper = dynamic_cast< ImageVtkMapper2D * >( node->GetMapper(1) ); //GetMapper(1) provides the 2D mapper for the data node
//if there is a 2D mapper, which is not the standard image mapper...
if(!imageMapper && node->GetMapper(1))
{ //... check if it is the composite mapper
std::string cname(node->GetMapper(1)->GetNameOfClass());
if(!cname.compare("CompositeMapper")) //string.compare returns 0 if the two strings are equal.
{
//get the standard image mapper.
//This is a special case in MITK and does only work for the CompositeMapper.
imageMapper = dynamic_cast<ImageVtkMapper2D* >( node->GetMapper(3) );
}
}
if ( (node->IsVisible(renderer)) && imageMapper )
{
WeakPointerProperty::Pointer rendererProp =
dynamic_cast< WeakPointerProperty * >(GetDataNode()->GetPropertyList()->GetProperty("renderer"));
if ( rendererProp.IsNotNull() )
{
BaseRenderer::Pointer planeRenderer = dynamic_cast< BaseRenderer * >(rendererProp->GetWeakPointer().GetPointer());
// Retrieve and update image to be mapped
const ImageVtkMapper2D::LocalStorage* localStorage = imageMapper->GetLocalStorage(planeRenderer);
if ( planeRenderer.IsNotNull() )
{
// perform update of imagemapper if needed (maybe the respective 2D renderwindow is not rendered/update before)
imageMapper->Update(planeRenderer);
// If it has not been initialized already in a previous pass,
// generate an actor and a texture object to
// render the image associated with the ImageVtkMapper2D.
vtkActor *imageActor;
vtkDataSetMapper *dataSetMapper = NULL;
vtkTexture *texture;
if ( m_ImageActors.count( imageMapper ) == 0 )
{
dataSetMapper = vtkDataSetMapper::New();
//Enable rendering without copying the image.
dataSetMapper->ImmediateModeRenderingOn();
texture = vtkTexture::New();
texture->RepeatOff();
imageActor = vtkActor::New();
imageActor->SetMapper( dataSetMapper );
imageActor->SetTexture( texture );
// Make imageActor the sole owner of the mapper and texture
// objects
dataSetMapper->UnRegister( NULL );
texture->UnRegister( NULL );
// Store the actor so that it may be accessed in following
// passes.
m_ImageActors[imageMapper].Initialize(imageActor, imageMapper, m_ImageMapperDeletedCommand);
}
else
{
// Else, retrieve the actor and associated objects from the
// previous pass.
imageActor = m_ImageActors[imageMapper].m_Actor;
dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
texture = imageActor->GetTexture();
}
// Set poly data new each time its object changes (e.g. when
// switching between planar and curved geometries)
if ( (dataSetMapper != NULL) && (dataSetMapper->GetInput() != surface->GetVtkPolyData()) )
{
dataSetMapper->SetInput( surface->GetVtkPolyData() );
}
//Check if the m_ReslicedImage is NULL.
//This is the case when no image geometry is met by
//the reslicer. In that case, the texture has to be
//empty (black) and we don't have to do anything.
//See fixed bug #13275
if(localStorage->m_ReslicedImage != NULL)
{
bool binaryOutline = node->IsOn( "outline binary", renderer );
if( binaryOutline )
{
texture->SetInput( localStorage->m_ReslicedImage );
}
else
{
texture->SetInput( localStorage->m_Texture->GetInput() );
}
// VTK (mis-)interprets unsigned char (binary) images as color images;
// So, we must manually turn on their mapping through a (gray scale) lookup table;
texture->SetMapColorScalarsThroughLookupTable( localStorage->m_Texture->GetMapColorScalarsThroughLookupTable() );
//.........这里部分代码省略.........
示例3: cname
void PlaneGeometryDataVtkMapper3D::ProcessNode(DataNode *node,
BaseRenderer *renderer,
Surface *surface,
LayerSortedActorList &layerSortedActors)
{
if (node != nullptr)
{
// we need to get the information from the 2D mapper to render the texture on the 3D plane
ImageVtkMapper2D *imageMapper =
dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(1)); // GetMapper(1) provides the 2D mapper for the data node
// if there is a 2D mapper, which is not the standard image mapper...
if (!imageMapper && node->GetMapper(1))
{ //... check if it is the composite mapper
std::string cname(node->GetMapper(1)->GetNameOfClass());
if (!cname.compare("CompositeMapper")) // string.compare returns 0 if the two strings are equal.
{
// get the standard image mapper.
// This is a special case in MITK and does only work for the CompositeMapper.
imageMapper = dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(3));
}
}
if ((node->IsVisible(renderer)) && imageMapper)
{
WeakPointerProperty::Pointer rendererProp =
dynamic_cast<WeakPointerProperty *>(GetDataNode()->GetPropertyList()->GetProperty("renderer"));
if (rendererProp.IsNotNull())
{
BaseRenderer::Pointer planeRenderer =
dynamic_cast<BaseRenderer *>(rendererProp->GetWeakPointer().GetPointer());
// Retrieve and update image to be mapped
const ImageVtkMapper2D::LocalStorage *localStorage = imageMapper->GetLocalStorage(planeRenderer);
if (planeRenderer.IsNotNull())
{
// perform update of imagemapper if needed (maybe the respective 2D renderwindow is not rendered/update
// before)
imageMapper->Update(planeRenderer);
// If it has not been initialized already in a previous pass,
// generate an actor and a texture object to
// render the image associated with the ImageVtkMapper2D.
vtkActor *imageActor;
vtkDataSetMapper *dataSetMapper = nullptr;
vtkTexture *texture;
if (m_ImageActors.count(imageMapper) == 0)
{
dataSetMapper = vtkDataSetMapper::New();
// Enable rendering without copying the image.
dataSetMapper->ImmediateModeRenderingOn();
texture = vtkNeverTranslucentTexture::New();
texture->RepeatOff();
imageActor = vtkActor::New();
imageActor->SetMapper(dataSetMapper);
imageActor->SetTexture(texture);
imageActor->GetProperty()->SetOpacity(
0.999); // HACK! otherwise VTK wouldn't recognize this as translucent
// surface (if LUT values map to alpha < 255
// improvement: apply "opacity" property onle HERE and also in 2D image mapper. DO NOT change LUT to
// achieve
// translucent images (see method ChangeOpacity in image mapper 2D)
// Make imageActor the sole owner of the mapper and texture
// objects
dataSetMapper->UnRegister(nullptr);
texture->UnRegister(nullptr);
// Store the actor so that it may be accessed in following
// passes.
m_ImageActors[imageMapper].Initialize(imageActor, imageMapper, m_ImageMapperDeletedCommand);
}
else
{
// Else, retrieve the actor and associated objects from the
// previous pass.
imageActor = m_ImageActors[imageMapper].m_Actor;
dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
texture = imageActor->GetTexture();
}
// Set poly data new each time its object changes (e.g. when
// switching between planar and curved geometries)
if ((dataSetMapper != nullptr) && (dataSetMapper->GetInput() != surface->GetVtkPolyData()))
{
dataSetMapper->SetInputData(surface->GetVtkPolyData());
}
dataSetMapper->Update();
// Check if the m_ReslicedImage is nullptr.
// This is the case when no image geometry is met by
// the reslicer. In that case, the texture has to be
// empty (black) and we don't have to do anything.
// See fixed bug #13275
if (localStorage->m_ReslicedImage != nullptr)
{
//.........这里部分代码省略.........