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

Java DicomObject类代码示例

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

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



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

示例1: query

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public List<DicomObject> query() throws IOException, InterruptedException {
    TransferCapability tc = assoc.getTransferCapabilityAsSCU(
            UID.ModalityWorklistInformationModelFIND);
    if (tc == null) {
        throw new NoPresentationContextException(
                "Modality Worklist not supported by "
                + remoteAE.getAETitle());
    }
    System.out.println("Send Query Request:");
    System.out.println(keys.toString());
    DimseRSP rsp = assoc.cfind(UID.ModalityWorklistInformationModelFIND,
            priority, keys, tc.getTransferSyntax()[0], cancelAfter);
    List<DicomObject> result = new ArrayList<DicomObject>();
    while (rsp.next()) {
        DicomObject cmd = rsp.getCommand();
        if (CommandUtils.isPending(cmd)) {
            DicomObject data = rsp.getDataset();
            result.add(data);
            System.out.println("\nReceived Query Response #"
                    + result.size() + ":");
            System.out.println(data.toString());
        }
    }
    return result;
}
 
开发者ID:avenda,项目名称:miniRIS,代码行数:26,代码来源:CFIND.java


示例2: outValue

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


示例3: NetworkDicomImageListViewModelElement

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
 * Non-public c'tor that does the actual work. Exactly one of (url, file) must be != null.
 * 
 * @param file
 * @param url
 * @param checkReadability
 * @param dcmObjectCache passed to superclass (see there)
 * @param imageFetchingJobsExecutor passed to superclass (see there)
 */
protected NetworkDicomImageListViewModelElement(File file, URL url, boolean checkReadability,
                        NumericPriorityMap<Object, DicomObject> dcmObjectCache, NumericPriorityThreadPoolExecutor imageFetchingJobsExecutor) {
    super(dcmObjectCache, imageFetchingJobsExecutor);
    try {
        if (url != null) {
            if (file != null) {
                throw new IllegalArgumentException("exactly one of (url,file) must be != null");
            }
            urlAsFile = null;
            setUrl(url, checkReadability);
        } else {
            //url == null
            if (file == null) {
                throw new IllegalArgumentException("exactly one of (url,file) must be != null");
            }
            urlAsFile = file.getAbsoluteFile();
            setUrl(file.toURI().toURL(), checkReadability);
        }
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:32,代码来源:NetworkDicomImageListViewModelElement.java


示例4: getBackendDicomObject

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
@Override
protected DicomObject getBackendDicomObject() {
    checkInitialized();
    try {

        URLConnection connection = url.openConnection();
        connection.setUseCaches(true);
        connection.setDefaultUseCaches(true);
            
        InputStream is = connection.getInputStream();
        // mark/reset not supported for url so using FileCacheImageInputStream
        DicomInputStream din = new DicomInputStream(new FileCacheImageInputStream(is, null));

        try {
            DicomObject dicomObject = din.readDicomObject();
            return dicomObject;
        } finally {
            din.close();
        }
    } catch (IOException e) {
        // TODO return error object instead?
        throw new IllegalStateException("error reading DICOM object from " + url, e);
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:25,代码来源:NetworkDicomImageListViewModelElement.java


示例5: FileBasedDicomImageListViewModelElement

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
 * Non-public c'tor that does the actual work. Exactly one of (url, file) must be != null.
 * 
 * @param file
 * @param url
 * @param checkReadability
 * @param dcmObjectCache passed to superclass (see there)
 * @param imageFetchingJobsExecutor passed to superclass (see there)
 */
protected FileBasedDicomImageListViewModelElement(File file, URL url, boolean checkReadability,
                                                  NumericPriorityMap<Object, DicomObject> dcmObjectCache, NumericPriorityThreadPoolExecutor imageFetchingJobsExecutor) {
    super(dcmObjectCache, imageFetchingJobsExecutor);
    try {
        if (url != null) {
            if (file != null) {
                throw new IllegalArgumentException("exactly one of (url,file) must be != null");
            }
            urlAsFile = null;
            setUrl(url, checkReadability);
        } else {
            //url == null
            if (file == null) {
                throw new IllegalArgumentException("exactly one of (url,file) must be != null");
            }
            urlAsFile = file.getAbsoluteFile();
            setUrl(file.toURI().toURL(), checkReadability);
        }
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:32,代码来源:FileBasedDicomImageListViewModelElement.java


示例6: getBackendDicomObject

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
@Override
    protected DicomObject getBackendDicomObject() {
//        try {
//            Thread.sleep(300);
//        } catch (InterruptedException e1) {
//        }
        checkInitialized();
        try {
            DicomInputStream din = new DicomInputStream(url.openStream());
            try {
                return din.readDicomObject();
            } finally {
                din.close();
            }
        } catch (IOException e) {
            // TODO return error object instead?
            throw new IllegalStateException("error reading DICOM object from " + url, e);
        }
    }
 
开发者ID:Sofd,项目名称:viskit,代码行数:20,代码来源:FileBasedDicomImageListViewModelElement.java


示例7: getWindowing

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


示例8: getImageOrientationPatient

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


示例9: createLut

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
 * Return the complete lookup table to apply to the image data. This
 * comprises the Modality LUT, VOI LUT and Presentation LUT. The Modality
 * LUT can be represented as rescale slope/intercept, and the VOI LUT can be
 * represented as window width/center/type. Presentation LUT will come from
 * the specified values in the image read parameter, and is designed to turn
 * p-values into DDLs (digital driving levels).
 *
 * @param param
 * @param raster
 * @return Complete lookup table to apply to the image.
 */
private LookupTable createLut(DicomImageReadParam param, int frame,
        Raster raster, int outBits) {
    short[] pval2gray = param.getPValue2Gray();
    DicomObject pr = param.getPresentationState();
    float c = param.getWindowCenter();
    float w = param.getWindowWidth();
    String vlutFct = param.getVoiLutFunction();
    /* // windowing disabled for this reader
    if (param.isAutoWindowing()) {
        DicomObject voiObj = VOIUtils.selectVoiObject(ds, pr, frame);
        if (voiObj == null) {
            float[] cw = VOIUtils.getMinMaxWindowCenterWidth(ds, pr, frame,
                    raster);
            c = cw[0];
            w = cw[1];
            vlutFct = LookupTable.LINEAR;
        }
    }
    */

    return LookupTable.createLutForImageWithPR(ds, pr, frame, c, w,
            vlutFct, outBits, pval2gray);   // outBits is fixed to 8 in the original dcm4che source -- will this work?
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:36,代码来源:RawDicomImageReader.java


示例10: maybeGetProxyRawImage

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


示例11: 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


示例12: main

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) throws Exception {
    String fileName = args[0];
    int scaleHeight = 30;
    if (args.length >= 2) {
        scaleHeight = Integer.parseInt(args[1]);
    }
    DicomInputStream din = new DicomInputStream(new File(fileName));
    try {
        DicomObject dobj = din.readDicomObject();
        PaintGrayscaleIntoDcmImageApp app = new PaintGrayscaleIntoDcmImageApp();
        app.paintGrayscaleInto(dobj, scaleHeight);
        File outfile = new File(fileName + ".with-grayscale.dcm");
        FileOutputStream fos = new FileOutputStream(outfile);
        DicomOutputStream dos = new DicomOutputStream(fos);
        try {
            dos.writeDicomFile(dobj);
        } finally {
            dos.close();
        }
    } finally {
        din.close();
    }
}
 
开发者ID:Sofd,项目名称:viskit,代码行数:27,代码来源:PaintGrayscaleIntoDcmImageApp.java


示例13: readDicom

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public static DicomObject readDicom(String filename) throws Exception
{
    java.io.File file = new java.io.File(filename);

    try
    {
        DicomObject obj = DicomUtil.readDicom(file);
        // DicomPrinter printer=new DicomPrinter(obj,System.out);
        // printer.printAll();

        return obj;
    }
    catch (IOException e)
    {
        throw new Exception("IOException: couldn't read:" + filename + "\n" + e.getMessage(), e);
    }
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:18,代码来源:Test_DicomUtil_ReadWrite.java


示例14: cmove

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
@Override
public void cmove(Association as, int pcid, DicomObject rq,
        DicomObject data) throws DicomServiceException, IOException
{
    log.info("just cmove");

    log.info(CommandUtils.toString(rq, pcid, "1.2.2.2.2.2.2.0"));
    DicomObject cmdrsp = CommandUtils.mkRSP(rq, CommandUtils.SUCCESS);
    DimseRSP rsp = doCMove(as, pcid, rq, data, cmdrsp);
    try {
        rsp.next();
    } catch (InterruptedException e) {
        throw new DicomServiceException(rq, Status.ProcessingFailure);
    }
    cmdrsp = rsp.getCommand();
    if (CommandUtils.isPending(cmdrsp))
    {
        as.registerCancelRQHandler(rq, rsp);
        //executor.execute(new WriteMultiDimseRsp(as, pcid, rsp));
    }
    else
    {
        as.writeDimseRSP(pcid, cmdrsp, rsp.getDataset());
    }
}
 
开发者ID:NCIP,项目名称:national-biomedical-image-archive,代码行数:26,代码来源:CMoveService.java


示例15: processFile

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
protected FSPath processFile(FSPath tmpDir, FSPath sourceFile, String destFilename) throws Exception
{
    logger.debugPrintf("Processing dicom file:%s to:%s\n", sourceFile, destFilename);

    DicomWrapper wrap = DicomWrapper.readFrom(sourceFile.getURI());

    wrap.setIsModifyable(true);
    wrap = dicomProcessor.process(wrap);

    wrap.performChecks(true);

    DicomObject dic = wrap.getDicomObject();
    FSPath destFile = tmpDir.resolvePath(destFilename);
    DicomUtil.writeDicom(dic, destFile.getPathname());

    return destFile;
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:18,代码来源:XnatTool.java


示例16: dumpFile

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public void dumpFile(String filename) throws IOException
{
    java.io.File file = new java.io.File(filename);

    boolean isDicom = false;

    if (this.noMagic == false)
    {
        isDicom = DicomUtil.hasDicomMagic(file);
    }
    else
    {
        isDicom = true;
    }

    if (isDicom == false)
    {
        throw new FileNotFoundException("Wrong Magic: File is NOT Dicom file:" + file);
    }

    DicomObject obj = DicomUtil.readDicom(file);
    dumpDicomObject("", "", "\n", obj);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:24,代码来源:DicomDumper.java


示例17: readDicom

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public static DicomObject readDicom(byte[] bytes) throws IOException
{
    ByteArrayInputStream bis = new ByteArrayInputStream(bytes);

    try
    {
        return readDicom(bis, -1);
    }
    finally
    {
        try
        {
            bis.close();
        }
        catch (IOException ignore)
        {
            ;
        }
    }
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:21,代码来源:DicomUtil.java


示例18: main

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public static void main(String args[])
{
    try
    {
        String home = GlobalProperties.getGlobalUserHome();
        String file = home + "/dicom/subset1/1.MR.head_DHead.4.1.20061214.091206.156000.1632817982.dcm";
        String fileOut = home + "/dicom/out/new1.MR.head_DHead.4.1.20061214.091206.156000.1632817982.dcm";

        DicomObject obj = DicomUtil.readDicom(file);
        changeFields(obj);
        DicomUtil.writeDicom(obj, fileOut);
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:18,代码来源:Test_DicomUtil_ReadWrite.java


示例19: testRead

import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
protected void testRead(String filename)
{
    java.io.File file = new java.io.File(filename);

    try
    {
        DicomObject obj = DicomUtil.readDicom(file);
        DicomWrapper wrap = new DicomWrapper(obj, file.toURI());
        List<String> names = wrap.getTagNames(true);

        for (String name : names)
        {
            outPrintf(" - %s\n", name);
        }

    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

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


示例20: doGetTotalFrameNumber

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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