Example #1
0
void Histogram::doUpdate( ::fwServices::ObjectMsg::csptr _msg) throw( ::fwTools::Failed)
{
    SLM_TRACE_FUNC();
}
Example #2
0
void SSplineAdaptor::configuring() throw(fwTools::Failed)
{
    SLM_TRACE_FUNC();
    OSLM_ASSERT("Wrong configuration tag name", m_configuration->getName() == "config");
    this->setRenderId(m_configuration->getAttributeValue("renderer"));
}
VtiImageReader::~VtiImageReader()
{
    SLM_TRACE_FUNC();
}
Example #4
0
void SSeriesDBReader::stopping() throw(::fwTools::Failed)
{
    SLM_TRACE_FUNC();
}
Example #5
0
void SRenderer::configuring()
{
    SLM_TRACE_FUNC();
    this->initialize();
}
Example #6
0
SeriesDBReader::~SeriesDBReader()
{
    SLM_TRACE_FUNC();
}
Example #7
0
DicomStudyReader::~DicomStudyReader()
{
    SLM_TRACE_FUNC();
}
void SPacsConfigurationEditor::receiving( ::fwServices::ObjectMsg::csptr _msg ) throw(::fwTools::Failed)
{
    SLM_TRACE_FUNC();
}
void SPacsConfigurationEditor::updating() throw(::fwTools::Failed)
{
    SLM_TRACE_FUNC();
}
Example #10
0
void SReadArray::starting() throw( ::fwTools::Failed )
{
    SLM_TRACE_FUNC();
}
void PlaneInteractor::doSwap() throw(fwTools::Failed)
{
    SLM_TRACE_FUNC();
    this->doStop();
    this->doStart();
}
Example #12
0
void Histogram::doUpdate() throw( ::fwTools::Failed)
{
    SLM_TRACE_FUNC();

    m_layer = new QGraphicsItemGroup();
    ::fwData::Histogram::sptr histogram = this->getObject< ::fwData::Histogram>();

    // Update color with opacity
    QColor color = m_color.color();
    color.setAlphaF( m_opacity );
    m_color.setColor( color );

    const float min = histogram->getMinValue();
    const float binsWidth = histogram->getBinsWidth();
    ::fwData::Histogram::fwHistogramValues values = histogram->getValues();

    // Initialize the path with a start point:
    // The value preceding the current value that we'll use to build the arcs of the path
    std::pair< double, double > startPoint = this->mapAdaptorToScene(
                std::pair<double, double>(min, values[0]), m_xAxis, m_yAxis);

    std::pair<double, double> pair;

    QBrush brush = QBrush(m_color.color());

    // Build the graphic items:
    const int nbValues = (int)values.size();
    for(int i = 1; i < nbValues; ++i)
    {
        pair = this->mapAdaptorToScene(
                std::pair<double, double>(min + i * binsWidth, values[i]), m_xAxis, m_yAxis);

        QPainterPath painter( QPointF(startPoint.first, 0) );
        painter.lineTo( startPoint.first, startPoint.second );
        painter.lineTo( pair.first, pair.second );
        painter.lineTo( pair.first, 0 );

        QGraphicsPathItem* item = new QGraphicsPathItem( painter );
        item->setPath( painter );
        item->setBrush( brush );
        item->setPen( Qt::NoPen );
        item->setCacheMode( QGraphicsItem::DeviceCoordinateCache );

        m_layer->addToGroup( item );
        /*
        QGraphicsRectItem* rect = new QGraphicsRectItem(startPoint.first, 0, pair.first - startPoint.first, pair.second);
        rect->setBrush( brush );
        rect->setPen( Qt::NoPen );
        m_layer->addToGroup( rect );
        */

        startPoint = pair;
    }

    // Adjust the layer's position and zValue depending on the associated axis
    m_layer->setPos(m_xAxis->getOrigin(), m_yAxis->getOrigin());
    m_layer->setZValue(m_zValue);

    // Add to the scene the unique item which gather the whole set of rectangle graphic items:
    this->getScene2DRender()->getScene()->addItem( m_layer );
}
Example #13
0
void Histogram::doStart() throw( ::fwTools::Failed)
{
    SLM_TRACE_FUNC();

    doUpdate();
}
Example #14
0
void Histogram::doStop() throw( ::fwTools::Failed)
{
    SLM_TRACE_FUNC();
}
Example #15
0
void DicomSurfaceWriter::writeSurfaceMesh(const unsigned int a_idx)
{
    SLM_TRACE_FUNC();

    ::boost::shared_ptr< ::gdcm::SurfaceWriter > gSurfaceWriter = ::boost::static_pointer_cast< ::gdcm::SurfaceWriter >( this->getWriter() );
    ::gdcm::DataSet & gDsRoot = this->getDataSet();

    // Get the last segment added in SegmentWriter::writeSurfaceSegmentation()
    ::gdcm::SmartPointer< ::gdcm::Segment > segment = gSurfaceWriter->GetSegments().back();

    // Add to it a surface
    ::gdcm::SmartPointer< ::gdcm::Surface > surface = new ::gdcm::Surface;
    segment->AddSurface(surface);

    ::fwData::Acquisition::sptr acq = this->getConcreteObject();
    ::fwData::Reconstruction::sptr reconstruction = acq->getReconstructions()[a_idx];
    ::fwData::Material::csptr material = reconstruction->getMaterial();

    // Set DicomSurface data
    m_surface->setFromData(reconstruction);    // NOTE: must be called before points and primitives writing

    //*** Create Surface Sequence ***//
    ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > gSqSurf = new ::gdcm::SequenceOfItems();
    gSqSurf->SetLengthToUndefined();
    {
        // Create one item for the surface
        ::gdcm::Item        gItSurf;
        gItSurf.SetVLToUndefined();
        ::gdcm::DataSet &   gDsSurf = gItSurf.GetNestedDataSet();

        // Surface Number (0x0066,0x0003)
        surface->SetSurfaceNumber( a_idx+1 );         // (start to 1)
        OSLM_TRACE("Surface Number : " << a_idx+1);

        // Surface Processing (0x0066,0x0009)
        surface->SetSurfaceProcessing( false );
        OSLM_TRACE("Surface Processing : NO");

        // Get reconstruction's color
        ::boost::array<float,4> rgba        = material->ambient()->getRGBA();

        // Recommended Display Grayscale Value (0x0062,0x000C)
        std::vector<float>      rgb(3);
        rgb[0] = rgba[0]; rgb[1] = rgba[1]; rgb[2] = rgba[2];
        const unsigned short    grayscale   = ::gdcm::SurfaceHelper::RGBToRecommendedDisplayGrayscale(rgb, 1.);
        surface->SetRecommendedDisplayGrayscaleValue( grayscale );
        OSLM_TRACE("Recommended Display Grayscale Value : " << grayscale);

        // Recommended Display CIELab Value (0x0062,0x000D)
        const std::vector<unsigned short>   CIELab      = ::gdcm::SurfaceHelper::RGBToRecommendedDisplayCIELab(rgb, 1.);
        surface->SetRecommendedDisplayCIELabValue( CIELab );
        OSLM_TRACE("Recommended Display CIELab Value : " << CIELab[0] << " " << CIELab[1] << " " << CIELab[2]);

        // Recommended Presentation Opacity (0x0066,0x000C)
        surface->SetRecommendedPresentationOpacity( rgba[3] );
        OSLM_TRACE("Recommended Presentation Opacity : " << rgba[3]);

        // Recommended Presentation Type (0x0066,0x000D)
        surface->SetRecommendedPresentationType( helper::GdcmData::convertToPresentationType(material->getRepresentationMode()) );
        OSLM_TRACE("Recommended Presentation Type : " << helper::DicomTools::convertToPresentationTypeString(material->getRepresentationMode()) );

//        helper::GdcmData::setTagValue<0x0066,0x000e>( (reconstruction->getIsClosed()?"YES":"NO"),   gDsSurf);   // Finite Volume
        bool _bIsClosed;
        if (::boost::logic::indeterminate(reconstruction->getCRefIsClosed()))
        {
            ::fwComEd::helper::Mesh helperMesh(reconstruction->getMesh());
            _bIsClosed = helperMesh.isClosed();
            reconstruction->setIsClosed(_bIsClosed);
        }
        else
        {
            _bIsClosed = reconstruction->getCRefIsClosed();
        }
        surface->SetFiniteVolume( (_bIsClosed ? ::gdcm::Surface::YES : ::gdcm::Surface::NO) );
        OSLM_TRACE("Finite Volume : " << (_bIsClosed?"YES":"NO"));

//        helper::GdcmData::setTagValue<0x0066,0x0010>("NO",                                          gDsSurf);   // Manifold
        surface->SetManifold( ::gdcm::Surface::NO );
        OSLM_TRACE("Manifold : NO");

        //*** Create Surface Points Sequence ***//
        ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > gSqPoints = new ::gdcm::SequenceOfItems();
        gSqPoints->SetLengthToUndefined();
        {
            // Create its item
            ::gdcm::Item gItPoints;
            gItPoints.SetVLToUndefined();

            // Number Of Points
            surface->SetNumberOfSurfacePoints( m_surface->getPointCoordSize() );
            OSLM_TRACE("Number Of Points : " << m_surface->getPointCoordSize());

            // Point Coordinates Data
            ::gdcm::DataElement &   pointCoordData          = surface->GetPointCoordinatesData();
            const float *           pointCoordinatesData    = m_surface->getPointCoordData().get();
            pointCoordData.SetByteValue( (char*) pointCoordinatesData, 3 * m_surface->getPointCoordSize() * sizeof(*pointCoordinatesData) );
            OSLM_TRACE("Point Coordinates Data buffer size : " << 3 * m_surface->getPointCoordSize() * sizeof(*pointCoordinatesData));

            gSqPoints->AddItem(gItPoints);

            helper::GdcmData::insertSQ<0x0066,0x0011>(gSqPoints, gDsSurf); // Surface Points Sequence
        }

        //*** Create Surface Normals Sequence ***//
        if (m_surface->getNormalCoordSize() > 0)
        {
            ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > gSqNormals = new ::gdcm::SequenceOfItems();
            gSqNormals->SetLengthToUndefined();
            {
                // Create its item
                ::gdcm::Item gItNormals;
                gItNormals.SetVLToUndefined();

                // Number Of Points
                surface->SetNumberOfVectors( m_surface->getNormalCoordSize() );
                OSLM_TRACE("Number Of Normals : " << m_surface->getNormalCoordSize());

                surface->SetVectorDimensionality(1);

                // Normal Coordinates Data
                ::gdcm::DataElement &   normalCoordData          = surface->GetVectorCoordinateData();
                const float *           normalCoordinatesData    = m_surface->getNormalCoordData().get();
                normalCoordData.SetByteValue( (char*) normalCoordinatesData, 3 * m_surface->getNormalCoordSize() * sizeof(*normalCoordinatesData) );
                OSLM_TRACE("Point Coordinates Data buffer size : " << 3 * m_surface->getNormalCoordSize() * sizeof(*normalCoordinatesData));

                gSqNormals->AddItem(gItNormals);

                helper::GdcmData::insertSQ<0x0066,0x0012>(gSqNormals, gDsSurf); // Surface Normal Sequence
            }
        }

        //*** Create Surface Mesh Primitives Sequence ***//
        //SEE: Supp 132 Table C.X-4
        ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > gSqPrimitives = new ::gdcm::SequenceOfItems();
        gSqPrimitives->SetLengthToUndefined();
        {
            // Create its item
            ::gdcm::Item gItPrimitives;
            gItPrimitives.SetVLToUndefined();

            // Mesh primitive type (fixed to TRIANGLE by FXW4SPL)
            ::gdcm::SmartPointer< ::gdcm::MeshPrimitive > primitive = surface->GetMeshPrimitive();
            primitive->SetPrimitiveType( ::gdcm::MeshPrimitive::TRIANGLE );

            // Triangle Point Index List
            ::gdcm::DataElement &   pointIndexData      = primitive->GetPrimitiveData();
            pointIndexData.SetVL( sizeof (uint32_t) );

            const uint32_t *        pointIndexListData  = m_surface->getPointIndexList().get();
            pointIndexData.SetByteValue( (char*) pointIndexListData, 3 * m_surface->getPointIndexSize() * sizeof(uint32_t) );
            OSLM_TRACE("Point Index List buffer size : " << 3 * m_surface->getPointIndexSize() * sizeof(uint32_t));

            gSqPrimitives->AddItem(gItPrimitives);

            helper::GdcmData::insertSQ<0x0066,0x0013>(gSqPrimitives, gDsSurf); // Surface Mesh Primitives Sequence
        }

        gSqSurf->AddItem(gItSurf);
    }

    helper::GdcmData::insertSQ<0x0066,0x0002>(gSqSurf, gDsRoot); // Surface Sequence


    //** Complete Segment Sequence **//

    //*** Create Algorithm Family Code Sequence ***//
    //See: Supp 132 Table 10-X
    {
        //see: PS.3.3 Table 8.8-1 and PS 3.16 Context ID 7162
        ::gdcm::SegmentHelper::BasicCodedEntry gAlgoFamily;
//        if ( reconstruction->getIsAutomatic() )
//        {
//            gAlgoFamily.CV = "1231011"; gAlgoFamily.CSD = "DCM"; gAlgoFamily.CM = "Deformable Models";   // FIXME : check
//        }
//        else
        {
            gAlgoFamily.CV = "1231009"; gAlgoFamily.CSD = "DCM"; gAlgoFamily.CM = "Manual Processing";
        }
        // Algorithm Family Code Sequence (0x0066,0x002F)
        surface->SetAlgorithmFamily( gAlgoFamily ); // Type 1
    }

    // Algorithm Version (0x0066,0x0031)
    surface->SetAlgorithmVersion("0.5");// Type 1 //FIXME

    // Algorithm Name (0x0066,0x0036)
    surface->SetAlgorithmName("VRMed"); // Type 1 //FIXME
}
Example #16
0
void SSignal::receiving( ::fwServices::ObjectMsg::csptr _msg ) throw( ::fwTools::Failed )
{
    SLM_TRACE_FUNC();
}
Example #17
0
DicomSurfaceWriter::~DicomSurfaceWriter()
{
    SLM_TRACE_FUNC();
}
Example #18
0
void SSignal::configuring() throw( ::fwTools::Failed )
{
    SLM_TRACE_FUNC() ;
    this->initialize();
}
void TransformationMatrix3DReaderService::stopping() throw(::fwTools::Failed)
{
    SLM_TRACE_FUNC();
}
Example #20
0
void SSignal::starting() throw( ::fwTools::Failed )
{
    SLM_TRACE_FUNC();
    this->actionServiceStarting();
}
Example #21
0
void DicomStudyReader::read() throw(::fwTools::Failed)
{
    SLM_TRACE_FUNC();

    ::fwData::Study::sptr       study       = this->getConcreteObject();
    SLM_ASSERT("::fwData::Study not set", study);

    //*****     Get all file names      *****//
    std::vector< std::string > studyFiles   = this->getFileNames(); // files which contain a common study
    OSLM_TRACE("Number of files for a study : " << studyFiles.size());

    //*****     Get group of file names for each series      *****//
    const ::gdcm::Tag   gTagSUID(0x0020,0x000e); // Series UID
    const ::gdcm::Tag   gTagImageType(0x0008,0x0008);  // ImageType
    gdcm::Scanner       gScanner;
    gScanner.AddTag(gTagSUID);
    gScanner.AddTag(gTagImageType);

    if( !gScanner.Scan( studyFiles ) )
    {
        throw ::fwTools::Failed("No series found");
    }

    ::gdcm::Directory::FilenamesType                    keys    = gScanner.GetKeys();
    ::gdcm::Directory::FilenamesType::const_iterator    it      = keys.begin();
    ::gdcm::Directory::FilenamesType::const_iterator    itEnd   = keys.end();

    // Create a map to associate each series with its files.
    std::map< std::string, std::vector< std::string > > seriesMap;    // Key : series UID ; Value : filenames found
    int secondaryCaptureCounter = 0;

    for(; it != itEnd; ++it)
    {
        const char * filename   = it->c_str();
        const char * seriesUID   = gScanner.GetValue(filename, gTagSUID);

        if (seriesUID != 0)
        {
            std::string seriesKey(seriesUID);
            // Treatment of secondary capture dicom file.
            if(gScanner.GetValue(filename, gTagImageType))
            {
                std::string imageType(gScanner.GetValue(filename, gTagImageType));
                std::string::size_type idx  = imageType.find("DERIVED\\SECONDARY");

                if( idx != std::string::npos)
                {
                    std::string::size_type endIdx  = imageType.find_first_not_of("DERIVED\\SECONDARY");
                    std::string optionalInfo = imageType.substr(endIdx);
                    std::ostringstream indice;
                    if(!optionalInfo.empty())
                    {
                        indice << optionalInfo;
                    }
                    else
                    {
                        // Tag as Secondary Capture
                        indice << "_SC_" << secondaryCaptureCounter;
                        secondaryCaptureCounter++;
                    }
                    seriesKey += indice.str();
                }
            }
            seriesMap[seriesKey].push_back( filename );
        }
        else
        {
            OSLM_ERROR ( "No study UID found in : " << filename );
        }
    }

    //*****     Read each patient (and so studies, series, ...)      *****//
    DicomSeriesReader  seriesReader;
    std::map< std::string, std::vector< std::string > >::iterator itMap     = seriesMap.begin();
    std::map< std::string, std::vector< std::string > >::iterator itMapEnd  = seriesMap.end();
    while (itMap != itMapEnd)
    {
        OSLM_TRACE ( "Series map key : " << itMap->first );
        if ( itMap->second.size() > 0 )
        {
            OSLM_TRACE ( "First series map value : " << *(itMap->second.begin()) );

            seriesReader.setFileNames(itMap->second);

            ::fwData::Acquisition::NewSptr series;
            seriesReader.setObject(series);
            try
            {
                // Read one series
                seriesReader.read();

                // Add a complete series
                study->addAcquisition(series);
            }
            catch (::fwTools::Failed & e)
            {
                OSLM_ERROR ("Reading error with series : " << itMap->first);
                // Acquisition skipped
            }
        }
        itMap++;
    }

    if(study->getNumberOfAcquisitions() == 0)
        throw ::fwTools::Failed("Study has no acquisition");

    //*****     Read study      *****//
    this->setReader( seriesReader.getReader() );
    this->readStudy();
}
Example #22
0
void IAdaptor::processInteraction( ::scene2D::data::Event::sptr _event )
{
    SLM_TRACE_FUNC();
}
Example #23
0
SRenderer::~SRenderer() noexcept
{
    SLM_TRACE_FUNC();
}
Example #24
0
Camera::~Camera()
{
    SLM_TRACE_FUNC();
}
Example #25
0
Edge::~Edge()
{
    SLM_TRACE_FUNC();
}
Example #26
0
void Camera::fetchFrame(unsigned char* frame)
{
    SLM_TRACE_FUNC();
    m_sigFrameFetched(frame);
}
VtiImageReader::VtiImageReader(::fwDataIO::reader::IObjectReader::Key key)
: ::fwData::location::enableSingleFile< ::fwDataIO::reader::IObjectReader >(this)
{
    SLM_TRACE_FUNC();
}
Example #28
0
static void notifyFrameFetched(JNIEnv *env, jobject thiz, int id, jbyteArray data)
{
    SLM_TRACE_FUNC();

    if (current_camera == NULL)
    {
        SLM_FATAL(" current_camera == NULL");
    }
    else
    {

        jboolean isCopy;
        jbyte* data_ptr = env->GetByteArrayElements(data, &isCopy);

        unsigned char* argb = new unsigned char[g_width * g_height * 4 * sizeof(unsigned char)];

        int size     = g_width * g_height;
        int v_offset = size;
        int u_offset = size +1;

        int y1_1,y1_2,y1_3,y1_4;
        int y2_1,y2_2,y2_3,y2_4;
        int y3_1,y3_2,y3_3,y3_4;
        int y4_1,y4_2,y4_3,y4_4;
        int u_1,u_2,u_3,u_4;
        int v_1,v_2,v_3,v_4;

        for(int i = 0, k = 0; i < size; i += 8, k += 8)
        {
            //-----------------------------------------------------------------------------
            // indexes
            //-----------------------------------------------------------------------------
            int id1 = i;
            int id2 = i+2;
            int id3 = i+4;
            int id4 = i+6;

            int k1 = k;
            int k2 = k+2;
            int k3 = k+4;
            int k4 = k+6;

            //-----------------------------------------------------------------------------
            // yuv components
            //-----------------------------------------------------------------------------

            // index 1
            y1_1 = data_ptr[id1  ]&0xff;
            y2_1 = data_ptr[id1+1]&0xff;
            y3_1 = data_ptr[g_width+id1  ]&0xff;
            y4_1 = data_ptr[g_width+id1+1]&0xff;

            u_1 = data_ptr[u_offset + k1]&0xff;
            v_1 = data_ptr[v_offset + k1]&0xff;

            u_1 -= 128;
            v_1 -= 128;

            // index 2
            y1_2 = data_ptr[id2  ]&0xff;
            y2_2 = data_ptr[id2+1]&0xff;
            y3_2 = data_ptr[g_width+id2  ]&0xff;
            y4_2 = data_ptr[g_width+id2+1]&0xff;

            u_2 = data_ptr[u_offset + k2]&0xff;
            v_2 = data_ptr[v_offset + k2]&0xff;

            u_2 -= 128;
            v_2 -= 128;

            //index 3
            y1_3 = data_ptr[id3  ]&0xff;
            y2_3 = data_ptr[id3+1]&0xff;
            y3_3 = data_ptr[g_width+id3  ]&0xff;
            y4_3 = data_ptr[g_width+id3+1]&0xff;

            u_3 = data_ptr[u_offset + k3]&0xff;
            v_3 = data_ptr[v_offset + k3]&0xff;

            u_3 -= 128;
            v_3 -= 128;

            //index 4
            y1_4 = data_ptr[id4  ]&0xff;
            y2_4 = data_ptr[id4+1]&0xff;
            y3_4 = data_ptr[g_width+id4  ]&0xff;
            y4_4 = data_ptr[g_width+id4+1]&0xff;

            u_4 = data_ptr[u_offset + k4]&0xff;
            v_4 = data_ptr[v_offset + k4]&0xff;

            u_4 = u_4 - 128;
            v_4 = v_4 - 128;

            //-----------------------------------------------------------------------------
            // Convert to rgb
            //-----------------------------------------------------------------------------
            convertYUVtoRGB(y1_1, u_1, v_1, id1*4, argb);
            convertYUVtoRGB(y2_1, u_1, v_1, (id1+1)*4, argb);
            convertYUVtoRGB(y3_1, u_1, v_1, (g_width+id1)*4, argb);
            convertYUVtoRGB(y4_1, u_1, v_1, (g_width+id1+1)*4, argb);

            convertYUVtoRGB(y1_2, u_2, v_2, (id2)*4, argb);
            convertYUVtoRGB(y2_2, u_2, v_2, (id2+1)*4, argb);
            convertYUVtoRGB(y3_2, u_2, v_2, (g_width+id2)*4, argb);
            convertYUVtoRGB(y4_2, u_2, v_2, (g_width+id2+1)*4, argb);

            convertYUVtoRGB(y1_3, u_3, v_3, (id3)*4, argb);
            convertYUVtoRGB(y2_3, u_3, v_3, (id3+1)*4, argb);
            convertYUVtoRGB(y3_3, u_3, v_3, (g_width+id3)*4, argb);
            convertYUVtoRGB(y4_3, u_3, v_3, (g_width+id3+1)*4, argb);

            convertYUVtoRGB(y1_4, u_4, v_4, (id4)*4, argb);
            convertYUVtoRGB(y2_4, u_4, v_4, (id4+1)*4, argb);
            convertYUVtoRGB(y3_4, u_4, v_4, (g_width+id4)*4, argb);
            convertYUVtoRGB(y4_4, u_4, v_4, (g_width+id4+1)*4, argb);

            //-----------------------------------------------------------------------------

            if (i!=0 && (i+8)%g_width==0)
            {
                i += g_width;
            }
        }
        // call the fechFrame method to emit signal
        current_camera->fetchFrame(argb);

        env->ReleaseByteArrayElements(data, data_ptr, JNI_ABORT);

    }
}
Example #29
0
void SSeriesDBReader::stopping()
{
    SLM_TRACE_FUNC();
}
Example #30
0
void MeshNormals::doSwap() throw( ::fwTools::Failed)
{
    SLM_TRACE_FUNC();
    this->doUpdate();
}