PACS-医学影像(二)

该文介绍了如何使用PACS系统进行医学影像的下载,包括创建连接、设置查询参数以及下载方法。同时,详细阐述了DicomObject接口,它是DICOM文件的主要数据结构,用于存储和操作DICOM元素。文章通过实例展示了如何接收和处理DICOM文件。
摘要由CSDN通过智能技术生成

目录

系列文章目录

一、创建连接

二、接收参数

1.DicomObject

2.接收dicom文件


 系列文章目录

第一章:PACS-医学影像(一)


一、创建连接

public class PacsMain {

    private DcmQR dcmqr;


     /**
     * 下载数据的方法
     *
     * @param queryLevel  查询级别
     * @param matchingKey 查询条件
     */
    public List<DicomObject> download(PacsInfo pacsInfo, DcmQR.QueryRetrieveLevel queryLevel, Map<String, String> matchingKey) throws Exception {
        List<DicomObject> returnList;
        // 设置参数
        creatInstance(pacsInfo.getScpAE(), pacsInfo.getScpHostname(), pacsInfo.getScpPort(), pacsInfo.getScuAE());
        setQueryLevel(queryLevel);
        setMatchingKey(matchingKey);
        returnList = downloadImage();
        dcmqr.start();
        dcmqr.open();
        dcmqr.close();
        dcmqr.stop();
        return returnList;
    }


    /**
     * 创建查询、下载请求功能类
     * @param scpAE 服务端AE
     * @param scpHost 服务端IP
     * @param scpPort 服务端PORT
     * @param scuAE 客户端AE
     */
    public synchronized void creatInstance(String scpAE, String scpHost,
                                           int scpPort, String scuAE) {

        dcmqr = new DcmQR(scuAE);
        dcmqr.setCalledAET(scpAE, false);
        dcmqr.setRemoteHost(scpHost);
        dcmqr.setRemotePort(scpPort);
        dcmqr.setPackPDV(true);
        dcmqr.setTcpNoDelay(true);
        dcmqr.setMaxOpsInvoked(1);
        dcmqr.setMaxOpsPerformed(0);
        dcmqr.setCFind(true);
        dcmqr.setCGet(false);
        dcmqr.setMoveDest(scuAE);
        dcmqr.addDefReturnKeys();
        dcmqr.configureTransferCapability(false);
    }


    public void setQueryLevel(DcmQR.QueryRetrieveLevel queryRetrieveLevel) {
        dcmqr.setQueryLevel(queryRetrieveLevel);
    }

    public void setMatchingKey(Map<String, String> matchConf) {
        for (Map.Entry<String, String> entry : matchConf.entrySet()) {
            dcmqr.addMatchingKey(Tag.toTagPath(entry.getKey()),
                    entry.getValue());
        }
    }


二、接收参数

1.DicomObject

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.dcm4che2.data;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Date;
import java.util.Iterator;

public interface DicomObject extends Serializable {
    int size();

    boolean isEmpty();

    void clear();

    DicomObject getRoot();

    boolean isRoot();

    DicomObject getParent();

    void setParent(DicomObject var1);

    SpecificCharacterSet getSpecificCharacterSet();

    Iterator<DicomElement> iterator();

    Iterator<DicomElement> iterator(int var1, int var2);

    Iterator<DicomElement> commandIterator();

    Iterator<DicomElement> fileMetaInfoIterator();

    Iterator<DicomElement> datasetIterator();

    int getItemPosition();

    void setItemPosition(int var1);

    long getItemOffset();

    void setItemOffset(long var1);

    VR vrOf(int var1);

    String nameOf(int var1);

    int resolveTag(int var1, String var2);

    int resolveTag(int var1, String var2, boolean var3);

    String getPrivateCreator(int var1);

    int vm(int var1);

    boolean contains(int var1);

    boolean containsValue(int var1);

    boolean containsAll(DicomObject var1);

    boolean accept(DicomObject.Visitor var1);

    void add(DicomElement var1);

    DicomElement remove(int var1);

    DicomElement remove(int[] var1);

    DicomElement get(int var1);

    DicomElement get(int var1, VR var2);

    DicomElement get(int[] var1);

    DicomElement get(int[] var1, VR var2);

    byte[] getBytes(int var1, boolean var2);

    byte[] getBytes(int var1);

    byte[] getBytes(int[] var1, boolean var2);

    byte[] getBytes(int[] var1);

    DicomObject getNestedDicomObject(int var1);

    DicomObject getNestedDicomObject(int[] var1);

    int getInt(int var1);

    int getInt(int var1, VR var2);

    int getInt(int var1, int var2);

    int getInt(int var1, VR var2, int var3);

    int getInt(int[] var1);

    int getInt(int[] var1, VR var2);

    int getInt(int[] var1, int var2);

    int getInt(int[] var1, VR var2, int var3);

    int[] getInts(int var1);

    int[] getInts(int var1, VR var2);

    int[] getInts(int var1, int[] var2);

    int[] getInts(int var1, VR var2, int[] var3);

    int[] getInts(int[] var1);

    int[] getInts(int[] var1, VR var2);

    int[] getInts(int[] var1, int[] var2);

    int[] getInts(int[] var1, VR var2, int[] var3);

    short[] getShorts(int var1);

    short[] getShorts(int var1, VR var2);

    short[] getShorts(int var1, short[] var2);

    short[] getShorts(int var1, VR var2, short[] var3);

    short[] getShorts(int[] var1);

    short[] getShorts(int[] var1, VR var2);

    short[] getShorts(int[] var1, short[] var2);

    short[] getShorts(int[] var1, VR var2, short[] var3);

    float getFloat(int var1);

    float getFloat(int var1, VR var2);

    float getFloat(int var1, float var2);

    float getFloat(int var1, VR var2, float var3);

    float getFloat(int[] var1);

    float getFloat(int[] var1, VR var2);

    float getFloat(int[] var1, float var2);

    float getFloat(int[] var1, VR var2, float var3);

    float[] getFloats(int var1);

    float[] getFloats(int var1, VR var2);

    float[] getFloats(int var1, float[] var2);

    float[] getFloats(int var1, VR var2, float[] var3);

    float[] getFloats(int[] var1);

    float[] getFloats(int[] var1, VR var2);

    float[] getFloats(int[] var1, float[] var2);

    float[] getFloats(int[] var1, VR var2, float[] var3);

    double getDouble(int var1);

    double getDouble(int var1, VR var2);

    double getDouble(int var1, double var2);

    double getDouble(int var1, VR var2, double var3);

    double getDouble(int[] var1);

    double getDouble(int[] var1, VR var2);

    double getDouble(int[] var1, double var2);

    double getDouble(int[] var1, VR var2, double var3);

    double[] getDoubles(int var1);

    double[] getDoubles(int var1, VR var2);

    double[] getDoubles(int var1, double[] var2);

    double[] getDoubles(int var1, VR var2, double[] var3);

    double[] getDoubles(int[] var1);

    double[] getDoubles(int[] var1, VR var2);

    double[] getDoubles(int[] var1, double[] var2);

    double[] getDoubles(int[] var1, VR var2, double[] var3);

    String getString(int var1);

    String getString(int var1, VR var2);

    String getString(int var1, String var2);

    String getString(int var1, VR var2, String var3);

    String getString(int[] var1);

    String getString(int[] var1, VR var2);

    String getString(int[] var1, String var2);

    String getString(int[] var1, VR var2, String var3);

    String[] getStrings(int var1);

    String[] getStrings(int var1, VR var2);

    String[] getStrings(int var1, String[] var2);

    String[] getStrings(int var1, VR var2, String[] var3);

    String[] getStrings(int[] var1);

    String[] getStrings(int[] var1, VR var2);

    String[] getStrings(int[] var1, String[] var2);

    String[] getStrings(int[] var1, VR var2, String[] var3);

    Date getDate(int var1);

    Date getDate(int var1, VR var2);

    Date getDate(int var1, Date var2);

    Date getDate(int var1, VR var2, Date var3);

    Date getDate(int var1, int var2);

    Date getDate(int var1, int var2, Date var3);

    Date getDate(int[] var1);

    Date getDate(int[] var1, VR var2);

    Date getDate(int[] var1, Date var2);

    Date getDate(int[] var1, VR var2, Date var3);

    Date getDate(int[] var1, int var2, int var3);

    Date getDate(int[] var1, int var2, int var3, Date var4);

    Date[] getDates(int var1);

    Date[] getDates(int var1, VR var2);

    Date[] getDates(int var1, Date[] var2);

    Date[] getDates(int var1, VR var2, Date[] var3);

    Date[] getDates(int var1, int var2);

    Date[] getDates(int var1, int var2, Date[] var3);

    Date[] getDates(int[] var1);

    Date[] getDates(int[] var1, VR var2);

    Date[] getDates(int[] var1, Date[] var2);

    Date[] getDates(int[] var1, VR var2, Date[] var3);

    Date[] getDates(int[] var1, int var2, int var3);

    Date[] getDates(int[] var1, int var2, int var3, Date[] var4);

    DateRange getDateRange(int var1);

    DateRange getDateRange(int var1, VR var2);

    DateRange getDateRange(int var1, DateRange var2);

    DateRange getDateRange(int var1, VR var2, DateRange var3);

    DateRange getDateRange(int var1, int var2);

    DateRange getDateRange(int var1, int var2, DateRange var3);

    DateRange getDateRange(int[] var1);

    DateRange getDateRange(int[] var1, VR var2);

    DateRange getDateRange(int[] var1, DateRange var2);

    DateRange getDateRange(int[] var1, VR var2, DateRange var3);

    DateRange getDateRange(int[] var1, int var2, int var3);

    DateRange getDateRange(int[] var1, int var2, int var3, DateRange var4);

    DicomElement putNull(int var1, VR var2);

    DicomElement putBytes(int var1, VR var2, byte[] var3);

    DicomElement putBytes(int var1, VR var2, byte[] var3, boolean var4);

    DicomElement putNestedDicomObject(int var1, DicomObject var2);

    DicomElement putInt(int var1, VR var2, int var3);

    DicomElement putInts(int var1, VR var2, int[] var3);

    DicomElement putShorts(int var1, VR var2, short[] var3);

    DicomElement putFloat(int var1, VR var2, float var3);

    DicomElement putFloats(int var1, VR var2, float[] var3);

    DicomElement putDouble(int var1, VR var2, double var3);

    DicomElement putDoubles(int var1, VR var2, double[] var3);

    DicomElement putString(int var1, VR var2, String var3);

    DicomElement putStrings(int var1, VR var2, String[] var3);

    DicomElement putDate(int var1, VR var2, Date var3);

    DicomElement putDates(int var1, VR var2, Date[] var3);

    DicomElement putDateRange(int var1, VR var2, DateRange var3);

    DicomElement putSequence(int var1);

    DicomElement putSequence(int var1, int var2);

    DicomElement putFragments(int var1, VR var2, boolean var3);

    DicomElement putFragments(int var1, VR var2, boolean var3, int var4);

    DicomElement putNull(int[] var1, VR var2);

    DicomElement putBytes(int[] var1, VR var2, byte[] var3);

    DicomElement putBytes(int[] var1, VR var2, byte[] var3, boolean var4);

    DicomElement putNestedDicomObject(int[] var1, DicomObject var2);

    DicomElement putInt(int[] var1, VR var2, int var3);

    DicomElement putInts(int[] var1, VR var2, int[] var3);

    DicomElement putShorts(int[] var1, VR var2, short[] var3);

    DicomElement putFloat(int[] var1, VR var2, float var3);

    DicomElement putFloats(int[] var1, VR var2, float[] var3);

    DicomElement putDouble(int[] var1, VR var2, double var3);

    DicomElement putDoubles(int[] var1, VR var2, double[] var3);

    DicomElement putString(int[] var1, VR var2, String var3);

    DicomElement putStrings(int[] var1, VR var2, String[] var3);

    DicomElement putDate(int[] var1, VR var2, Date var3);

    DicomElement putDates(int[] var1, VR var2, Date[] var3);

    DicomElement putDateRange(int[] var1, VR var2, DateRange var3);

    DicomElement putSequence(int[] var1);

    DicomElement putSequence(int[] var1, int var2);

    DicomElement putFragments(int[] var1, VR var2, boolean var3);

    DicomElement putFragments(int[] var1, VR var2, boolean var3, int var4);

    void shareElements();

    void serializeElements(ObjectOutputStream var1) throws IOException;

    void copyTo(DicomObject var1);

    boolean matches(DicomObject var1, boolean var2);

    boolean cacheGet();

    void cacheGet(boolean var1);

    boolean cachePut();

    void cachePut(boolean var1);

    boolean bigEndian();

    void bigEndian(boolean var1);

    DicomObject command();

    DicomObject dataset();

    DicomObject fileMetaInfo();

    DicomObject subSet(DicomObject var1);

    DicomObject subSet(int var1, int var2);

    DicomObject subSet(int[] var1);

    DicomObject exclude(int[] var1);

    DicomObject excludePrivate();

    void initFileMetaInformation(String var1);

    void initFileMetaInformation(String var1, String var2, String var3);

    int toStringBuffer(StringBuffer var1, DicomObjectToStringParam var2);

    public interface Visitor {
        boolean visit(DicomElement var1);
    }
}

2.接收dicom文件

代码如下(示例):

 private List<DicomObject> downloadImage() throws IOException, InterruptedException {

        List<DicomObject> result = Collections.singletonList(dcmqr.getKeys());
        if (dcmqr.isCMove()) {
            dcmqr.move(result);
        } else if (dcmqr.isCGet()) {
            dcmqr.get(result);
        }

        return result;
    }

本文介绍接收dicom文件的方法,有兴趣留言沟通~


这个软件包包含了Dicom相关的小软件,包括Dicom读写,以及网络相关的软件,每功能一般都是一个独立的程序,很实用。<br><br>PACSview inherits its basic functionality from ACRNview, but accesses not to single image files, but to image boxes, which content complete image sets of studies. Additional features of PACSview are related to the fact that PACSview operates with whole studies - in opposite to ACRNview, that only knows singles images: <br>When you open a study, icons for all images of that study are displayed, grouped in so called overview images. You can select one image for displaying by double clicking the corresponding icon. It's also possible to scroll through all images according defined sequences, or to print all images of one study at once. There is also a feature for automatically printing of studies, when arriving in the image box. (PACSview can also communicate with our RIS ("AURA") - via a TCP/IP connection - to retrieve textual Patient records for every study in the image box.) <br><br>In the current installation in our hospital, this image boxes are located on a separate server machine (so called PACSview-Server), to which the PACSview-Clients access via NFS. The front-end of each box is a DICOM Storage Service Class Provider, which receives images via C-STORE DICOM Message Service Elements and stores them - together with created overview images - in the image box. The PC version of this program (PVSTORE.EXE) is also part of the PACSview-Client SW. On request, there is also a version for a Sun SPARCserver (tested under SunOS 5.5.1) available. The current version of PVSTORE.EXE makes the assumption, that images receiving during one DICOM association belongs to one study. <br><br>In the application of PACSview for image distribution inside of our hospital, the image boxes are filled by extern - referred to the PACSview SW - processes, controlled by our RIS. But a DICOM Query/Retrieve Service Class User is already integrated in the PACSview SW, hence you could also query image archives - and retrieve images from it - directly by the PACSview-Client. <br><br>
1引言................................................ ............................................................. ................................ 3 1.1结构............................................ ................................................. ............................................. 3 1.2支持的语言............................................... .................................................................... .......... .4 1.3使用COM对象模型的效果.......................................... ........................................................... 4 1.4 DicomObjects中的集合.............................................. .............................................................. 4 1.5 Dicom对象的DICOM数据表示........................................................................ ....................... 5 1.6解释和使用序列............................................. .......................................................................... 7 1.7私有属性............................................... .................................................................... ............... 7 2第一步 - 阅读,查看和写入DICOM文件................................................................... ............. 9 2.1您的第一个DICOM计划............................................. ............................................................. 9 2.2将映像写入磁盘............................................ ......................................................................... 10 3通过网络简单地发送和接收图像........................................ .................................................... 11 3.1发送图像.................................................. ................................................................ .............. 11 3.2接收图像............................................... ..................................................................... ............ 11 4查询/检索(SCU)........................................... .......................................................... .............. 13 4.1公共特性............................................... ................................................................... .............. 13 4.2 DoQuery ............................................... ................................................................................ . 14 4.3 GetImages ............................................... ............................................................................... 14 4.4 GetUsingMove ................................................ ........................................................................15 4.5 DoRawQuery ................................................ ...........................................................................15 4.6 MoveSync ................................................ ................................................................................15 4.7 MoveImages ................................................ ............................................................................15 4.8基于Dicom连接的Q / R方法........................................... ............................ ....... ......... ..... 15 5离线媒体............................................. ................................................. ..... ....... ........................17 5.1阅读............................................... ................................................. .......... ....... ....... ..............17 5.2创建................................................ ................................................. ....................................... 18 5.3更新............................................... ................................................. ........................................ 19 5.4乘以引用的目录记录............................................. ................................................................ 19 6打印............................................ ................................................. .............................................. 20 6.1使用DicomPrint打印.................................................. ........................................................... 20 6.2使用标准化操作打印............................................. ................................................................ 22 6.3将DICOM图像打印到Windows打印机.......................................... ..................................... 22 7将DICOM图像导出到其他格式........................................... .................................................... 23 7.1单帧............................................... ................................................. ........................................ 23 7.2多帧图像/电影........................................... ............................................................................. 23 7.3非文件导出............................................. ...................................................................... ......... 23 8高级图像审查站............................................. ........................................................................... 24 8.1基本查看控件................................................ ......................................................................... 24 8.2多帧(电影)图像.......................................... ....................................................................... 24 8.3注释............................................ ................................................. ........................................... 25 8.4查找表............................................... ................................................. .................................... 28 8.5 DICOM灰度呈现状态............................................. ................................................................ 28 8.6显示速度优化................................................ ......................................................................... 29 9网络使用............................................... ......................................................... ........................... 31 9.1在Web服务器上运行DicomObjects . .... .......................................... ................................... 31 9.2在Web客户端上运行DicomObjects .......... .... .................................. .................................. 33 10写路由器/修改器.................................. .... .... .............. ...................................................... ... 35 11编写DICOM服务器............................................. ................................................................ ... 36 11.1聆听协会的对象........................................... ........................................................................ 36 11.2验证协会............................................... ................................................................................ 37 11.3处理C-STORE操作............................................ ................................................................... 37 11.4处理查询/检索请求............................................ ................................................................. 38 11.5处理C-ECHO请求............................................ .................................................................... 42 11.6传输语法和质量问题............................................ ............................................................... 42 11.7性能和可靠性问题............................................. .................................................................. 43 11.8模态WorkList SCP .............................................. .................................................................. 44 11.9打印SCP ............................................... ................................................. .............................. 44 11.10存储承诺SCP ................................................ ..................................................................... 45 12访问和修改像素数据............................................ .................................................................. 46 12.1原始指针的语言............................................. ...................................................................... 46 12.2使用变量数组的语言............................................. .............................................................. 47 13创建DICOM图像.............................................. .................................................................. ... 48 13.1导入其他格式................................................ ....................................................................... 48 13.2导入多帧图像.................................................. ..................................................................... 49 13.3从划痕............................................... ................................................................... ............... 50 14使用模态WorkList作为SCU ........................................... ...................................................... 52 15语言特定功能.............................................. ............................................................................ 53 15.1 Visual Basic ............................................... .................................................. ......................... 53 15.2 VBScript ................................................ ................................................. .............................. 53 15.3应用程序的Visual Basic(例如MS Access)........................................ ............................. 53 15.4 Microsoft Visual C ++ ................................................ ........................................................ ... 53 15.5 Borland Delphi和Borland C ++ Builder ........................................... .................................... 55 15.6 Java ................................................ ................................................. ..................................... 56 15.7其他环境............................................... ................................................. .............................. 56 16日志记录................................................ ................................................. ................................ 57 16.1日志详细信息和级别............................................. ........................................................... .. 57 16.2文件记录............................................... ................................................. .............................. 57 16.3 DicomLog控制................................................ ...................................................................... 58 17高级使用............................................... ................................................. ................................. 59 17.1超车注册表值............................................ ........................................................................... 59 17.2更改默认SOP类的列表.......................................... ............................................................ 59 17.3传输语法选择.................................................. ..................................................................... 60 17.4私人SOP类................................................ .................................................................. ....... 61 17.5私有传输语法........................................................................................................................ 61 17.6存储承诺............................................... ............................................................................ ... 61
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

音阙斯听

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值