Beispiel #1
0
void SRenderer::refresh()
{
    auto img = this->getInput< ::fwData::Image >(s_IMAGE_KEY);
    SLM_ASSERT("'" + s_IMAGE_KEY + "' key not found", img);
    bool imageIsValid = ::fwDataTools::fieldHelper::MedicalImageHelpers::checkImageValidity( img );
    if(imageIsValid )
    {
        if(!m_bPipelineIsInit)
        {
            initVTKPipeline();
            m_bPipelineIsInit = true;
        }
        else
        {
            updateVTKPipeline();
        }

        //
        int axialIndex    = static_cast<int>(img->getSize()[2]/2);
        int frontalIndex  = static_cast<int>(img->getSize()[1]/2);
        int sagittalIndex = static_cast<int>(img->getSize()[0]/2);

        m_negatoAxial->SetSliceIndex( axialIndex );
        m_negatoFrontal->SetSliceIndex( frontalIndex );
        m_negatoSagittal->SetSliceIndex( sagittalIndex );
        m_interactorManager->getInteractor()->Render();
    }
}
void ImageViewerService::updating( ::fwServices::ObjectMsg::csptr _msg ) throw(::fwTools::Failed)
{
    // If message is a ImageMsg and if event is NEW IMAGE
    ::fwComEd::ImageMsg::csptr pImageMsg = ::fwComEd::ImageMsg::dynamicConstCast( _msg ) ;
    if ( pImageMsg && pImageMsg->hasEvent( ::fwComEd::ImageMsg::NEW_IMAGE ) )
    {
        updateVTKPipeline();
    }
}
void RendererService::receiving( ::fwServices::ObjectMsg::csptr _msg ) throw(fwTools::Failed)
{
    ::fwComEd::MeshMsg::csptr meshMsg = ::fwComEd::MeshMsg::dynamicConstCast(_msg);
    if ( meshMsg && meshMsg->hasEvent( ::fwComEd::MeshMsg::NEW_MESH ) )
    {
        if(!m_bPipelineIsInit)
        {
            initVTKPipeline();
            m_bPipelineIsInit = true;
        }
        else
        {
            updateVTKPipeline();
        }
        m_interactorManager->getInteractor()->Render();
    }
}