本文整理汇总了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);
}
示例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;
}
示例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));
}
}
示例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;
}