当前位置: 首页>>代码示例>>C++>>正文


C++ Series::setModality方法代码示例

本文整理汇总了C++中Series::setModality方法的典型用法代码示例。如果您正苦于以下问题:C++ Series::setModality方法的具体用法?C++ Series::setModality怎么用?C++ Series::setModality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Series的用法示例。


在下文中一共展示了Series::setModality方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: build

Volume* VolumeBuilderFromCaptures::build()
{
    Q_ASSERT(m_parentStudy);
    Q_ASSERT(m_vtkImageAppend->GetNumberOfInputs());

    // Creem la nova sèrie
    Series *newSeries = new Series();

    // Omplim la informació de la sèrie a partir de la sèrie de referència

    // Assignem la modalitat segons el valor introduit. El valor per defecte és 'OT' (Other).
    newSeries->setModality(m_modality);
    newSeries->setSOPClassUID(QString(UID_SecondaryCaptureImageStorage));

    // Generem el SeriesInstanceUID a partir del generador de DCMTK. \TODO Utilitzar el nostre UID_ROOT?
    char seriesUid[100];
    dcmGenerateUniqueIdentifier(seriesUid, SITE_SERIES_UID_ROOT);
    newSeries->setInstanceUID(QString(seriesUid));
    // \TODO Quin criteri volem seguir per donar nous noms?
    newSeries->setSeriesNumber(QString("0000") + QString::number(m_parentStudy->getSeries().count()));
    newSeries->setDescription(this->getSeriesDescription());

    // Assignem la sèrie a l'estudi al qual partenyia l'inputVolume.
    newSeries->setParentStudy(m_parentStudy);
    m_parentStudy->addSeries(newSeries);

    // Obtenim el nou vtkImageData a partir de la sortida del vtkImageAppend.
    // Fem un flip horitzontal per tal utilitzar el mateix sistema de coordenades que DICOM.
    m_vtkImageAppend->Update();

    vtkSmartPointer<vtkImageData> newVtkData = vtkSmartPointer<vtkImageData>::New();
    newVtkData->ShallowCopy(m_vtkImageAppend->GetOutput());

    // Creem el nou volume
    Volume *newVolume = new Volume();
    newSeries->addVolume(newVolume);

    // Generem les noves imatges a partir del vtkData generat per vtkImageAppend
    int samplesPerPixel = newVtkData->GetNumberOfScalarComponents();
    int bitsAllocated;
    int bitsStored;
    int highBit;
    int pixelRepresentation;
    int rows;
    int columns;

    // \TODO Potser podriem ser mes precisos
    QString photometricInterpretation;
    if (samplesPerPixel == 1)
    {
        photometricInterpretation = QString("MONOCHROME2");
    }
    else if (samplesPerPixel == 3)
    {
        photometricInterpretation = QString("RGB");
    }

    int scalarType = newVtkData->GetScalarType();

    switch (scalarType)
    {
        //case VTK_CHAR:
        //break;
        case VTK_SIGNED_CHAR:
            bitsAllocated = 8;
            pixelRepresentation = 1;
            break;
        case VTK_UNSIGNED_CHAR:
            bitsAllocated = 8;
            pixelRepresentation = 0;
            break;
        case VTK_SHORT:
            bitsAllocated = 16;
            pixelRepresentation = 1;
            break;
        case VTK_UNSIGNED_SHORT:
            bitsAllocated = 16;
            pixelRepresentation = 0;
            break;
        case VTK_INT:
            bitsAllocated = 32;
            pixelRepresentation = 1;
            break;
        case VTK_UNSIGNED_INT:
            bitsAllocated = 32;
            pixelRepresentation = 0;
            break;
//        case VTK_FLOAT:
//            bitsAllocated = 32;
//            pixelRepresentation = 1; ?
//            break;
//        case VTK_DOUBLE:
//            bitsAllocated = 64;
//            pixelRepresentation = 1; ?
//            break;
        default:
            DEBUG_LOG(QString("Pixel Type no suportat: ") + newVtkData->GetScalarTypeAsString());

    }

//.........这里部分代码省略.........
开发者ID:chinhtrandn,项目名称:starviewer,代码行数:101,代码来源:volumebuilderfromcaptures.cpp


注:本文中的Series::setModality方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。