void CameraReaderService::updating() throw(::fwTools::Failed)
{
    SLM_TRACE_FUNC();

    if( this->hasLocationDefined() )
    {
        // Retrieve object
        ::fwData::Camera::sptr cam = this->getObject< ::fwData::Camera>( );
        SLM_ASSERT("cam not instanced", cam);

        OSLM_INFO("path: " << this->getFile().string());
        this->loadCalibration(this->getFile().string(), cam);

        // Notify reading
        ::fwComEd::CameraMsg::sptr msg = ::fwComEd::CameraMsg::New();
        msg->addEvent( ::fwComEd::CameraMsg::NEW_CAMERA ) ;

        ::fwServices::IEditionService::notify(this->getSptr(), cam, msg);
    }
}
void MemoryConsumption::pushNewArray(size_t memorySizeInBytes)
{
    try
    {
        ::fwData::Array::sptr buffer = ::fwData::Array::New();
        ::fwData::Array::SizeType size(1, memorySizeInBytes);
        buffer->resize(::fwTools::Type::s_UINT8_TYPENAME, size, 1, true);

        OSLM_INFO("Creating a fwData::array consuming "<< memorySizeInBytes/(1024*1024) << " Mo ") ;

        memoryConsumer.push_back( buffer ) ;
    }
    catch( std::exception &e )
    {
        std::stringstream msg ;
        msg << "Cannot allocate buffer (256 Mo) :\n" << e.what() << std::endl ;
        ::fwGui::dialog::MessageDialog::showMessageDialog(
                            "Action increase memory",
                            msg.str(),
                            ::fwGui::dialog::IMessageDialog::CRITICAL);
    }
}
const BundleDescriptorReader::BundleContainer BundleDescriptorReader::createBundles(const ::boost::filesystem::path& location) throw(RuntimeException)
{
    // Normalizes the path.
    ::boost::filesystem::path normalizedPath(location);
    normalizedPath.normalize();

    // Asserts that the repository is a valid directory path.
    if(::boost::filesystem::exists(normalizedPath) == false || ::boost::filesystem::is_directory(normalizedPath) == false)
    {
        throw RuntimeException("'" + normalizedPath.string() + "': not a directory.");
    }

    // Walk through the repository entries.
    BundleContainer bundles;
    ::boost::filesystem::directory_iterator   currentEntry(normalizedPath);
    ::boost::filesystem::directory_iterator   endEntry;
    for(; currentEntry != endEntry; ++currentEntry)
    {
        ::boost::filesystem::path entryPath = *currentEntry;

        if(::boost::filesystem::is_directory(entryPath))
        {
            try
            {
                SPTR( ::fwRuntime::Bundle ) bundle = BundleDescriptorReader::createBundle(entryPath);
                if(bundle)
                {
                    bundles.push_back( bundle );
                }
            }
            catch(const RuntimeException& runtimeException)
            {
                OSLM_INFO( "'"<< entryPath.string() << "': skipped. " << runtimeException.what() );
            }
        }
    }
    return bundles;
}
//-----------------------------------------------------------------------------
void RendererService::createAndAddActorToRender()
{
    //Check there is indeed a Composite object in this:
    assert(this->getObject< ::fwData::Composite >());

    //Create a pointer on this object:
    ::fwData::Composite::sptr myComposite = this->getObject< ::fwData::Composite >();

    OSLM_INFO( "VTK Pipeline ready TO UPDATE" << '\n' << "Object received:" << myComposite->getLeafClassname());

    // elementnumber increases for each mesh found:
    unsigned int elementNumber=0;

    //Loop through the composite objects, if it's a mesh, then render it:
    for(::fwData::Composite::ContainerType::const_iterator it = myComposite->begin(); it != myComposite->end(); ++it)
    {
        OSLM_INFO("ObjectName: " << it->first);
        OSLM_INFO("ObjectPointer: " << it->second);
        OSLM_INFO("ObjectType: " << it->second->getClassname () << '\n');

        ::fwData::Mesh::sptr myMesh =::fwData::Mesh::dynamicCast (it->second);

        // If it's a mesh, then put it in the pipeline:
        if( myMesh )
        {
            vtkSmartPointer<vtkPolyData> vtk_polyData = vtkSmartPointer<vtkPolyData>::New();
            ::fwVtkIO::helper::Mesh::toVTKMesh( myMesh, vtk_polyData);
            OSLM_INFO("Loaded: " << it->first);
            vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();

            m_normals = vtkPolyDataNormals::New();
            m_normals->SetInputData(vtk_polyData);
            mapper->SetInputConnection(m_normals->GetOutputPort());

            vtkActor* actor =  vtkActor::New();
            actor->SetMapper( mapper);

            // Add the actors
            m_render->AddActor( actor);


            OSLM_INFO("Mesh found: " << it->first);
            if (!myMesh->getField( "MaterialMesh" ))
            {
                // No Material data then default
                if(elementNumber == 0)
                {
                    actor->GetProperty()->EdgeVisibilityOn();
                    actor->GetProperty()->SetInterpolationToFlat();
                    actor->GetProperty()->SetColor (1.0, 0.0, 0.0);
                    actor->GetProperty()->SetEdgeColor (1.0, 0.0, 0.0);
                }
                else
                {
                    actor->GetProperty()->SetRepresentationToWireframe ();
                    actor->GetProperty()->SetColor (1.0, 1.0, 1.0);
                }
            }
            else
            {
                // Material exists
                ::fwData::Material::sptr matObjPtr = myMesh->getField< ::fwData::Material >( "MaterialMesh" );
                actor->GetProperty()->SetColor (matObjPtr->ambient()->red(), matObjPtr->ambient()->green(), matObjPtr->ambient()->blue());
            }
            mapper->Delete();
            elementNumber++;
            OSLM_INFO("displayed: " << it->first);
        }
    }
    m_interactorManager->getInteractor()->SetInteractorStyle(vtkInteractorStyleTrackballCamera::New());
    m_loc = new vtkLocalCommand(this);
    m_interactorManager->getInteractor()->AddObserver(vtkCommand::AnyEvent, m_loc);

    // Repaint and resize window
    m_render->ResetCamera();
}
Beispiel #5
0
 void doNothing()
 {
     OSLM_INFO("DO NOTHING");
     ++m_methodDoNothing;
 }
Beispiel #6
0
 int square (int a)
 {
     OSLM_INFO("SQUARE " << a );
     ++m_methodSquare;
     return a*a;
 }
Beispiel #7
0
 int sum(int a, int b)
 {
     OSLM_INFO("SUM " << a << " + " << b);
     ++m_methodSum;
     return a+b;
 }
Beispiel #8
0
void ItkLogger::DisplayText(const char* _txt)
{
    OSLM_INFO("[ITK]: " << _txt);
}