• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Tag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Tag类属于org.dcm4che2.data包,在下文中一共展示了Tag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: CFIND

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public CFIND(String name) {
    device = new Device(name);
    executor = new NewThreadExecutor(name);
    remoteAE.setInstalled(true);
    remoteAE.setAssociationAcceptor(true);
    remoteAE.setNetworkConnection(new NetworkConnection[] { remoteConn });

    device.setNetworkApplicationEntity(ae);
    device.setNetworkConnection(conn);
    ae.setNetworkConnection(conn);
    ae.setAssociationInitiator(true);
    ae.setAETitle(name);
    for (int i = 0; i < RETURN_KEYS.length; i++) {
        keys.putNull(RETURN_KEYS[i], null);
    }        
    keys.putNestedDicomObject(Tag.RequestedProcedureCodeSequence,
            new BasicDicomObject());
    keys.putNestedDicomObject(Tag.ScheduledProcedureStepSequence, spsKeys);
    for (int i = 0; i < SPS_RETURN_KEYS.length; i++) {
        spsKeys.putNull(SPS_RETURN_KEYS[i], null);
    }
    spsKeys.putNestedDicomObject(Tag.ScheduledProtocolCodeSequence,
            new BasicDicomObject());
}
 
开发者ID:avenda,项目名称:miniRIS,代码行数:25,代码来源:CFIND.java


示例2: readValue

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public boolean readValue(DicomInputStream in) throws IOException {
       //System.out.println("-"+TagUtils.toString(in.tag())+"-");


            switch (in.tag()) {
            case Tag.Item:
                if (in.sq().vr() != VR.SQ && in.valueLength() != -1) {
                    outFragment(in);
                } else {
                    outItem(in);                    
                }
                break;
            case Tag.ItemDelimitationItem:
            case Tag.SequenceDelimitationItem: 
                if (in.level() > 0)
                    outItem(in);
                break;
            default:
                outElement(in);
            }
        


return true;
    }
 
开发者ID:alcir,项目名称:dicomfileCopy,代码行数:26,代码来源:Dcm2Txt.java


示例3: outValue

import org.dcm4che2.data.Tag; //导入依赖的package包/类
private void outValue(DicomInputStream in) throws IOException {
//      System.out.println("outvalue");
      int tag = in.tag();
      VR vr = in.vr();
      byte[] val = in.readBytes(in.valueLength());
      DicomObject dcmobj = in.getDicomObject();
      boolean bigEndian = in.getTransferSyntax().bigEndian();
      line.append(" [xxx ");
      vr.promptValue(val, bigEndian, dcmobj.getSpecificCharacterSet(),
              cbuf, maxValLen, line);
      line.append("xxx]");
         
      if (tag == Tag.SpecificCharacterSet
              || tag == Tag.TransferSyntaxUID
              || TagUtils.isPrivateCreatorDataElement(tag)) {
          dcmobj.putBytes(tag, vr, val, bigEndian);
      }
      if (tag == 0x00020000) {
          in.setEndOfFileMetaInfoPosition(
                  in.getStreamPosition() + vr.toInt(val, bigEndian));
      }
  }
 
开发者ID:alcir,项目名称:dicomfileCopy,代码行数:23,代码来源:Dcm2Txt.java


示例4: getRangeFromDicomObjects

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public static ShortRange getRangeFromDicomObjects(ArrayList<DicomObject> dicomList) {
    short min = Short.MAX_VALUE;
    short max = Short.MIN_VALUE;

    for (DicomObject dicomObject : dicomList) {
        short[] buffer = dicomObject.getShorts(Tag.PixelData);
        
        for (short value : buffer) {
            
            if (value < min)
                min = value;

            if (value > max)
                max = value;
        }
    }

    return new ShortRange(min, max);
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:20,代码来源:ImageUtil.java


示例5: getWindowing

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public static ShortBuffer getWindowing(ArrayList<DicomObject> dicomList, ShortRange range) {
    ShortBuffer windowing = ShortBuffer.allocate(dicomList.size() * 2);
    
    for (DicomObject dicomObject : dicomList) {
        short winCenter = (short) dicomObject.getFloat(Tag.WindowCenter);
        short winWidth = (short) dicomObject.getFloat(Tag.WindowWidth);

        if (winCenter == 0 && winWidth == 0) {
            winWidth = (short) Math.min(range.getDelta(), Short.MAX_VALUE);
            winCenter = (short) (range.getMin() + range.getDelta() / 2);
        }

        windowing.put(winCenter);
        windowing.put(winWidth);

    }

    windowing.rewind();

    return windowing;
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:22,代码来源:DicomUtil.java


示例6: getImageOrientationPatient

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public static float[] getImageOrientationPatient(DicomObject o, int frame)
{
    float[] iop;
    if ((iop = o.getFloats(Tag.ImageOrientationPatient)) != null)
        return iop;
    
    // Check the shared first in the case of image orientation
    int[] tagPath = { 
            Tag.SharedFunctionalGroupsSequence, 0,
            Tag.PlaneOrientationSequence, 0,
            Tag.ImageOrientationPatient };
    if ((iop = o.getFloats(tagPath)) != null)
        return iop;
    
    tagPath[0] = Tag.PerFrameFunctionalGroupsSequence;
    tagPath[1] = frame;
    return o.getFloats(tagPath);
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:19,代码来源:DicomUtil.java


示例7: maybeGetProxyRawImage

import org.dcm4che2.data.Tag; //导入依赖的package包/类
protected RawImageImpl maybeGetProxyRawImage() {
    DicomObject imgMetadata = getDicomImageMetaData();
    
    String transferSyntaxUID = imgMetadata.getString(Tag.TransferSyntaxUID);
    //logger.debug(getImageKey());
    //logger.debug("transferSyntaxUID : " + transferSyntaxUID);
    
    //jpeg or rle compressed
    if (transferSyntaxUID != null && 
            (transferSyntaxUID.startsWith("1.2.840.10008.1.2.4") ||
             transferSyntaxUID.startsWith("1.2.840.10008.1.2.5")))
        return null;
    
    int pixelType = getPixelType(imgMetadata);
    if (pixelType == RawImage.PIXEL_TYPE_NOT_SUPPORTED)
        return null;

    int pixelFormat = getPixelFormat(imgMetadata);
    if (pixelFormat == RawImage.PIXEL_FORMAT_NOT_SUPPORTED)
        return null;

    int width = imgMetadata.getInt(Tag.Columns);
    int height = imgMetadata.getInt(Tag.Rows);
    
    return new RawImageImpl(width, height, pixelFormat, pixelType, null);
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:27,代码来源:ViskitDicomImageBase.java


示例8: setUsedPixelValuesRange

import org.dcm4che2.data.Tag; //导入依赖的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


示例9: getTimeZone

import org.dcm4che2.data.Tag; //导入依赖的package包/类
/**
 * Returns TimeZone or default TimeZone if not set in the Dicom File
 */
public TimeZone getTimeZone()
{
    DicomElement tzOffset = dicom.get(Tag.TimezoneOffsetFromUTC);
    if (tzOffset == null)
    {
        return defaultTZ; // TimeZone.getDefault(); //
                          // TimeZone.getTimeZone("UTC");
    }

    String tzStr = element2String(tzOffset, null);
    // [+|-]HHMM
    // int tzInt=element2Int(tzOffset, 0);
    char c = tzStr.charAt(0);
    if ((c != '-') && (c != '+'))
        tzStr = "+" + tzStr;

    TimeZone tz = TimeZone.getTimeZone("GMT" + tzStr);

    return tz;
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:24,代码来源:DicomWrapper.java


示例10: testCreateDicomBytes

import org.dcm4che2.data.Tag; //导入依赖的package包/类
@Test
public void testCreateDicomBytes() throws Exception
{
    // Test empty dicom
    DicomObject dicom = DicomUtil.createNewDicom(true);

    DicomWrapper wrap = new DicomWrapper(dicom, null);
    wrap.setIsModifyable(true);

    String uid = "1.0";
    wrap.setTag(Tag.StudyInstanceUID, uid);
    Assert.assertEquals(wrap.getStudyInstanceUID(), uid);

    byte bytes[] = wrap.getBytes();
    Assert.assertTrue("bytes created from empty dicom object doesnt contain 'DICM' magic", DicomUtil.hasDicomMagic(bytes));

    DicomObject dicom2 = DicomUtil.readDicom(bytes);
    DicomWrapper wrap2 = new DicomWrapper(dicom2, null);
    Assert.assertEquals("Re-created Dicom Object must contain similar StudyInstanceUID", uid, wrap2.getStudyInstanceUID());

}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:22,代码来源:Test_DicomProcessor.java


示例11: TestHashStringTags

import org.dcm4che2.data.Tag; //导入依赖的package包/类
@Test
public void TestHashStringTags() throws Exception
{
    String dicomConfig = "Group,Element,VR,Name,Keep,Option\n"
            + "0x0010,0x0010,PN,\"Patient Name\",1,HASH\n"
            + "0x0010,0x0020,LO,\"Patient ID\",1,HASH\n";

    DicomTags tags = DicomTags.createFromText(dicomConfig);
    DicomProcessor defProc = new DicomProcessor(tags, DicomTestUtil.createDefaultProcOpts("testid", "12345"));

    // ID and single component of a PatientName may not exceed 64 bytes!
    // 32 byte hash = 44 character base64 encoded String.

    testProcessStringTag(defProc, "patientId", Tag.PatientID, "OQ7j3Pylj4ePLwafb62s15Iw05sjNlwXU7lWooz/5Ic=", 44);
    testProcessStringTag(defProc, "patientName", Tag.PatientName, "+mdCPEZtV/tIzprOh3gBRU8n1kGfUxpcp2BXkEwwI18=", 44);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:17,代码来源:Test_DicomProcessor.java


示例12: TestHashUIDStringTags

import org.dcm4che2.data.Tag; //导入依赖的package包/类
@Test
public void TestHashUIDStringTags() throws Exception
{
    String dicomConfig = "Group,Element,VR,Name,Keep,Option\n"
            + "0x0020,0x000D,UI,\"Study Instance UID\",1,HASH_UID\n"
            + "0x0020,0x000E,UI,\"Series Instance UID\",1,HASH_UID\n";

    DicomTags tags = DicomTags.createFromText(dicomConfig);
    DicomProcessor defProc = new DicomProcessor(tags, DicomTestUtil.createDefaultProcOpts("testid", "12345"));

    // ID and single component of a PatientName may not exceed 64 bytes!
    // 32 byte hash = 44 character base64 encoded String.
    testProcessStringTag(defProc, "1.2.3.4.5", Tag.StudyInstanceUID, "99.4204629107754314596487061406589837754705824752771508063909",
            61);
    testProcessStringTag(defProc, "1.2.3.4.5.6", Tag.SeriesInstanceUID,
            "99.4546193923923468677598443730882976073381443147326160939328", 61);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:18,代码来源:Test_DicomProcessor.java


示例13: TestEncryptHashUIDStringTags

import org.dcm4che2.data.Tag; //导入依赖的package包/类
@Test
public void TestEncryptHashUIDStringTags() throws Exception
{
    String dicomConfig = "Group,Element,VR,Name,Keep,Option\n"
            + "0x0020,0x000D,UI,\"Study Instance UID\",1,ENCRYPT_HASH_UID\n"
            + "0x0020,0x000E,UI,\"Series Instance UID\",1,ENCRYPT_HASH_UID\n";

    DicomTags tags = DicomTags.createFromText(dicomConfig);
    DicomProcessor defProc = new DicomProcessor(tags, DicomTestUtil.createDefaultProcOpts("testid", "12345"));

    // ID and single component of a PatientName may not exceed 64 bytes!
    // 32 byte hash = 44 character base64 encoded String.
    testProcessStringTag(defProc, "1.2.3.4.5", Tag.StudyInstanceUID, "99.4172487386883469284013742100485763316631486852937852953349",
            61);
    testProcessStringTag(defProc, "1.2.3.4.5.6", Tag.SeriesInstanceUID,
            "99.5865990744155969053175599961344212888999959344684303397440", 61);

}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:19,代码来源:Test_DicomProcessor.java


示例14: doGetTotalFrameNumber

import org.dcm4che2.data.Tag; //导入依赖的package包/类
protected int doGetTotalFrameNumber() {
    // extract the frame count from the getDicomObject() by default.
    ImageReader reader;
    int numFrames;
    ImageInputStream in;
    try {
        DicomObject dcmObj = getDicomObject();
        ByteArrayOutputStream bos = new ByteArrayOutputStream(200000);
        DicomOutputStream dos = new DicomOutputStream(bos);
        String tsuid = dcmObj.getString(Tag.TransferSyntaxUID);
        if (null == tsuid) {
            tsuid = UID.ImplicitVRLittleEndian;
        }
        FileMetaInformation fmi = new FileMetaInformation(dcmObj);
        fmi = new FileMetaInformation(fmi.getMediaStorageSOPClassUID(), fmi.getMediaStorageSOPInstanceUID(), tsuid);
        dos.writeFileMetaInformation(fmi.getDicomObject());
        dos.writeDataset(dcmObj, tsuid);
        dos.close();
        
        reader = new DicomImageReaderSpi().createReaderInstance();
        in = ImageIO.createImageInputStream(new ByteArrayInputStream(bos.toByteArray()));
        if (null == in) {
            throw new IllegalStateException(
                    "The DICOM image I/O filter (from dcm4che1) must be available to read images.");
        }
        try {
            reader.setInput(in);
            numFrames = reader.getNumImages(true);
        } finally {
            in.close();
        }
    }
    catch (IOException e) {
        throw new IllegalStateException("error reading DICOM object from " + getKey(), e);
    }
    return numFrames;
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:38,代码来源:CachingDicomImageListViewModelElement.java


示例15: getBackendDicomImageMetaData

import org.dcm4che2.data.Tag; //导入依赖的package包/类
/**
 * Same as {@link #getBackendDicomObject() }, but for the DICOM metadata ({@link #getDicomImageMetaData() }).
 * Default implementation extracts the metadata from the getBackendDicomObject().
 *
 * @return
 */
protected DicomObject getBackendDicomImageMetaData() {
    // even though the getDicomObject() could serve as the metadata object
    // (it's a superset of it -- essentially, it's the metadata plus the pixel data),
    // we extract the metadata subset and return that, because it will be much smaller
    // in terms of memory footprint and thus many more of these objects fit in the
    // dicomMetadataCache. Alternatively, we might also not have a dicomMetadataCache
    // at all and always return the getDicomObject() directly, relying on its cache --
    // but it contains fewer elements, and the returned complete getDicomObject()s
    // would be large and may consume large amounts of heap space depending on how
    // long the caller keeps those DicomObjects referenced
    DicomObject result = new BasicDicomObject();
    getBackendDicomObject().subSet(0, Tag.PixelData - 1).copyTo(result);  // make a deep copy so no reference to the PixelData is kept
    return result;
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:21,代码来源:CachingDicomImageListViewModelElement.java


示例16: compare

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public int compare(ImageListViewModelElement elt1, ImageListViewModelElement elt2) {
    if (!(elt1 instanceof DicomImageListViewModelElement)) {
        throw new IllegalArgumentException("not a DicomImageListViewModelElement: " + elt1);
    }
    if (!(elt2 instanceof DicomImageListViewModelElement)) {
        throw new IllegalArgumentException("not a DicomImageListViewModelElement: " + elt2);
    }
    DicomObject d1 = ((FileBasedDicomImageListViewModelElement)elt1).getDicomImageMetaData();
    DicomObject d2 = ((FileBasedDicomImageListViewModelElement)elt2).getDicomImageMetaData();
    Double v1 = d1.getDouble(Tag.SliceLocation, -Double.MAX_VALUE);
    Double v2 = d2.getDouble(Tag.SliceLocation, -Double.MAX_VALUE);
    return v1.compareTo(v2);
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:14,代码来源:SliceLocationComparator.java


示例17: run

import org.dcm4che2.data.Tag; //导入依赖的package包/类
@Override
public Double run(DicomObject dobj) {
    try {
        return (double)dobj.getInt(Tag.BitsStored) / 8.0 * dobj.getInt(Tag.Columns) * dobj.getInt(Tag.Rows);
        //TODO: account for frame count
    } catch (Exception ex) {
        logger.error("couldn't determine size of DICOM object " + dobj + ": " + ex.getMessage(), ex);
        return 1e6;
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:11,代码来源:Config.java


示例18: getOriginalImageWidth

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public int getOriginalImageWidth() {
    ImageListViewModelElement elt = displayedCell.getDisplayedModelElement();
    if (elt instanceof DicomImageListViewModelElement) {
        // performance optimization for this case -- read the value from DICOM metadata instead of getting the image
        DicomImageListViewModelElement dicomElt = (DicomImageListViewModelElement) elt;
        return dicomElt.getDicomImageMetaData().getInt(Tag.Columns);
    } else {
        return elt.getImage().getWidth();
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:11,代码来源:BaseImageListViewCellViewer.java


示例19: getOriginalImageHeight

import org.dcm4che2.data.Tag; //导入依赖的package包/类
public int getOriginalImageHeight() {
    ImageListViewModelElement elt = displayedCell.getDisplayedModelElement();
    if (elt instanceof DicomImageListViewModelElement) {
        // performance optimization for this case -- read the value from DICOM metadata instead of getting the image
        DicomImageListViewModelElement dicomElt = (DicomImageListViewModelElement) elt;
        return dicomElt.getDicomImageMetaData().getInt(Tag.Rows);
    } else {
        return elt.getImage().getHeight();
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:11,代码来源:BaseImageListViewCellViewer.java


示例20: getDistanceLabel

import org.dcm4che2.data.Tag; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UDPAddressingMode类代码示例发布时间:2022-05-23
下一篇:
Java JRPrinterAWT类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap