java 如何用dcm4che中的工具从pacs下载图像,findscu和getscu的区别,以及getscu实现的话,pacs系统需要设置本地的ae信息吗
这是因为你在黑色面板和黄色面板中都设置了内容填充面板的 JLabel 组件,但是只有一个面板可以显示在窗体上。当你切换面板时,前一个面板上的所有组件都会被移除,包括图片 JLabel。
解决方法是:
java
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Trans {
public static void main(String[] args) {
new Window("window");
}
}
class Window extends JFrame{
//...
//窗体内容面板
private JPanel contentPanel;
//显示图片的 JLabel
private JLabel imageLabel;
public Window(String s) {
super(s);
super.getContentPane().setLayout(null);
//图片 JLabel 填充整个窗体
imageLabel = new JLabel();
imageLabel.setBounds(0, 0, 1280, 720);
super.getContentPane().add(imageLabel, Integer.MIN_VALUE);
//设置窗口风格
super.setBounds(123,30,1290,725);
super.setVisible(true);
super.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//显示黑色面板
showBlackPanel();
}
//显示黑色面板
public void showBlackPanel() {
contentPanel = (JPanel) super.getContentPane();
contentPanel.setOpaque(false);
contentPanel.setBackground(Color.black);
//...
//设置图片
ImageIcon icon1 = new ImageIcon("res/1.jpg");
imageLabel.setIcon(icon1);
}
//显示黄色面板
public void showYellowPanel() {
//...
//设置图片
ImageIcon icon2 = new ImageIcon("res/凯尔希.jpg");
imageLabel.setIcon(icon2);
}
}
这样就可以在不同的面板中切换图片了。
可以使用dcm4che中的findscu和getscu工具从pacs下载图像。findscu用于在pacs中查找符合特定条件的图像,getscu用于从pacs中下载符合特定条件的图像。
findscu用于在pacs中查找符合特定条件的图像,而getscu用于从pacs中下载符合特定条件的图像。findscu只能查找图像,而getscu可以查找并下载图像。
是的,要实现getscu下载图像,需要在pacs系统中设置本地的ae信息。这些信息包括:
在设置这些信息之后,就可以使用getscu工具从pacs中下载图像了。
以下是使用dcm4che中的getscu工具从pacs下载符合特定条件的图像的Java代码示例:
import org.dcm4che3.data.Attributes;
import org.dcm4che3.data.Tag;
import org.dcm4che3.net.*;
import java.io.File;
import java.io.IOException;
public class PacsDownloader {
private static final String PACS_AE_TITLE = "PACS_AE_TITLE"; // pacs系统的AE title private static final String PACS_HOST = "PACS_HOST"; // pacs系统的IP地址 private static final int PACS_PORT = 104; // pacs系统的端口号
public static void main(String[] args) throws IOException, InterruptedException {
// 创建一个C-GET请求 Association association = new Association();
association.setAssociationName("PacsDownloader");
association.setCalledAET(PACS_AE_TITLE);
association.setCalling(new ApplicationEntity());
association.getCalling().setAETitle("MY_APP");
association.getCalling().setInstalled(true);
association.setPackPDV(true);
association.setAsyncOpsWindow(new AsyncOpsWindow(1, 1));
association.setIdentityRQ(new MyIdentityRQ());
Device device = new Device("MY_APP");
device.setInstalled(true);
device.setNetworkConnection(new TCPNetworkConnection(PACS_HOST, PACS_PORT));
device.setAssociationInitiator(new AssociationInitiator(device, association));
// 设置查询条件 String patientName = "John^Doe";
String studyDate = "20220101";
String modality = "CT";
String seriesNumber = "1";
// 构造C-FIND请求,查找符合条件的图像 Attributes query = new Attributes();
query.setString(Tag.PatientName, VR.PN, patientName);
query.setString(Tag.StudyDate, VR.DA, studyDate);
query.setString(Tag.Modality, VR.CS, modality);
query.setString(Tag.SeriesNumber, VR.IS, seriesNumber);
Association cfindAssociation = device.connect();
FindSCU findSCU = new FindSCU(cfindAssociation);
findSCU.addAttributes(query);
findSCU.setPriority(Priority.NORMAL);
findSCU.setInformationModel(InformationModel.StudyRoot);
findSCU.setResultSet(true);
// 执行C-FIND请求,获取符合条件的图像 findSCU.open();
findSCU.retrieveResult();
findSCU.close();
// 构造C-GET请求,下载符合条件的图像 Attributes retrieve = new Attributes();
retrieve.setString(Tag.PatientName, VR.PN, patientName);
retrieve.setString(Tag.StudyDate, VR.DA, studyDate);
retrieve.setString(Tag.Modality, VR.CS, modality);
retrieve.setString(Tag.SeriesNumber, VR.IS, seriesNumber);
Association cgetAssociation = device.connect();
GetSCU getSCU = new GetSCU(cgetAssociation);
getSCU.addAttributes(retrieve);
getSCU.setPriority(Priority.NORMAL);
getSCU.setInformationModel(InformationModel.StudyRoot);
getSCU.setDestinationTransferSyntax(TransferSyntax.ImplicitVRLittleEndian);
// 下载符合条件的图像 getSCU.open();
while (getSCU.hasNext()) {
File file = new File("/path/to/save/images");
getSCU.next(file);
}
getSCU.close();
cfindAssociation.release();
cgetAssociation.release();
}
private static class MyIdentityRQ extends IdentityRQ {
public MyIdentityRQ() {
setCalledAET(PACS_AE_TITLE);
setCallingAET("MY_APP");
setImplementationClassUID("1.2.3.4.5.6.7.8.9");
setImplementationVersionName("1.0");
}
}
}
注意,上述代码中的查询条件只是示例,需要根据实际需求进行修改。同时,需要将代码中的PACS_AE_TITLE和PACS_HOST替换为实际的pacs系统的AE title和IP地址。另外,还需要引入dcm4che的相关依赖库。