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


Java DicomObject.contains方法代码示例

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


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

示例1: setUsedPixelValuesRange

import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
protected void setUsedPixelValuesRange() {
    FloatRange range = super.getUsedPixelValuesRange();
    
    //correct for RescaleSlope/-Intercept Tags
    float min = range.getMin();
    float max = range.getMax();
    DicomObject metadata = getDicomImageMetaData();
    if (metadata.contains(Tag.RescaleSlope) && metadata.contains(Tag.RescaleIntercept)) {
        float rscSlope = metadata.getFloat(Tag.RescaleSlope);
        float rscIntercept = metadata.getFloat(Tag.RescaleIntercept);
        min = (int) (rscSlope * min + rscIntercept);
        max = (int) (rscSlope * max + rscIntercept);
    }
    
    usedPixelValuesRange = new FloatRange(min, max);
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:17,代码来源:ViskitDicomImageBase.java

示例2: getDistanceLabel

import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
protected String getDistanceLabel(ImageListViewCell cell, Point2D p0, Point2D p1) {
    double dx = (p1.getX() - p0.getX()) / cell.getScale();
    double dy = (p1.getY() - p0.getY()) / cell.getScale();
    String unit = " pixel";
    ImageListViewModelElement elt = cell.getDisplayedModelElement();
    if (elt instanceof DicomImageListViewModelElement) {
        DicomImageListViewModelElement delt = (DicomImageListViewModelElement) elt;
        DicomObject dcm = delt.getDicomImageMetaData();
        float[] rowCol;
        try {
            if (dcm.contains(Tag.PixelSpacing)) {
                rowCol = dcm.getFloats(Tag.PixelSpacing);
                if ((rowCol.length != 2) || (rowCol[0] <= 0) || (rowCol[1] <= 0)) {
                    throw new RuntimeException("Illegal PixelSpacing tag in DICOM metadata (2 positive real numbers expected)");
                }
            } else if (dcm.contains(Tag.ImagerPixelSpacing)) {
                rowCol = dcm.getFloats(Tag.ImagerPixelSpacing);
                if ((rowCol.length != 2) || (rowCol[0] <= 0) || (rowCol[1] <= 0)) {
                    throw new RuntimeException("Illegal ImagerPixelSpacing tag in DICOM metadata (2 positive real numbers expected)");
                }
            } else {
                throw new RuntimeException("DICOM metadata contained neither a PixelSpacing nor an ImagerPixelSpacing tag");
            }
            dx *= rowCol[1];
            dy *= rowCol[0];
            unit = " mm";
        } catch (RuntimeException e) {
            // ignore, fall back to pixels (s.a.)
        }
    }
    return "" + df.format(Math.sqrt(dx*dx + dy*dy)) + unit;
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:33,代码来源:ImageListViewMouseMeasurementController.java

示例3: setWindowingToDcm

import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
private static void setWindowingToDcm(ImageListViewCell cell) {
    DicomImageListViewModelElement elt = (DicomImageListViewModelElement) cell.getDisplayedModelElement();
    DicomObject dobj = elt.getDicomImageMetaData();
    if (dobj.contains(Tag.WindowCenter) && dobj.contains(Tag.WindowWidth)) {
        cell.setWindowLocation((int) dobj.getFloat(Tag.WindowCenter));
        cell.setWindowWidth((int) dobj.getFloat(Tag.WindowWidth));
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:9,代码来源:SingleFrameTestApp.java

示例4: calculatePixelValueRange

import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
@Override
protected float[] calculatePixelValueRange(ListModel model) {
    float[] minMaxRange = new float[2];
    if (model.getSize() > 0) {
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        CachingDicomImageListViewModelElement element = (CachingDicomImageListViewModelElement) model
                .getElementAt(0);
        DicomObject metadata = element.getDicomImageMetaData();

        // DICOM object contains pixel value range for complete series
        if (metadata.contains(Tag.SmallestPixelValueInSeries) && metadata.contains(Tag.LargestPixelValueInSeries)) {
            min = metadata.getInt(Tag.SmallestPixelValueInSeries);
            max = metadata.getInt(Tag.LargestPixelValueInSeries);
            logger.debug("Pixel value range in series found: " + element);
        }
        // iterate through all model elements and find the smallest
        else {
            logger
                    .debug("Pixel value range in series not found, iterate through all model elements to calculate pixel value range for series");

            long startTime = System.currentTimeMillis();
            for (int i = 0; i < model.getSize(); i++) {
                // TODO if this model element is a frame calculation just
                // for the first frame
                element = (CachingDicomImageListViewModelElement) model.getElementAt(i);
                FloatRange range = element.getImage().getUsedPixelValuesRange();
                float currentMin = range.getMin();
                float currentMax = range.getMax();

                if (currentMin < min) {
                    min = (int) currentMin;
                }
                if (currentMax > max) {
                    max = (int) currentMax;
                }
            }
            logger.debug("[Min,Max] Range Calculation finished! Processing time: "
                    + (System.currentTimeMillis() - startTime) + " ms");
        }
        
        minMaxRange[0] = min;
        minMaxRange[1] = max;
    } else {
        logger.info("Model does not contain any DICOM files!");
    }
    return minMaxRange;
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:49,代码来源:DicomModelFactory.java


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