Java结合Swing处理Dicom图像集,实现翻页、左侧缩略图、窗宽位调整

一、代码部分

/**
 * @program: yan-api
 * @description:
 * @author: yc
 * @create: 2025-03-17 10:42
 **/
public class DicomViewer3 extends JFrame {

    // 图像:显示区域
    private JLabel imageLabel;
    // 状态栏:记录当前索引
    private JLabel statusLabel;
    // 上一页、下一页按钮
    private JButton prevButton;
    private JButton nextButton;

    private JSlider windowWidthSlider;
    private JSlider windowCenterSlider;
    private JLabel wwValueLabel;
    private JLabel wlValueLabel;

    // DICOM文件集合
    private List<File> dicomFileList = new ArrayList<>();
    // 当前DICOM文件索引
    private int currentSliceIndex = -1;


    private double[] huPixelData;
    private int width, height;
    private double rescaleSlope = 1.0;
    private double rescaleIntercept = 0.0;

    // 缩略图相关变量
    private static final int THUMBNAIL_WIDTH = 120;
    private static final int PREVIEW_COUNT = 3;

    // 创建缩略图面板
    private JPanel thumbnailPanel;


    private final Map<File, BufferedImage> thumbnailCache = new HashMap<>();

    public static void main(String[] args) {
        EventQueue.invokeLater(() -> {
            DicomViewer3 viewer = new DicomViewer3();
            viewer.setVisible(true);
        });
    }


   //............

}

完整代码联系 1393579546@qq.com

二、maven配置

<!--医学图像处理-->
<dependency>
    <groupId>org.dcm4che</groupId>
    <artifactId>dcm4che-core</artifactId>
    <version>5.27.0</version>
</dependency>
<dependency>
    <groupId>org.dcm4che</groupId>
    <artifactId>dcm4che-imageio</artifactId>
    <version>5.27.0</version>
</dependency>
<dependency>
    <groupId>org.dcm4che</groupId>
    <artifactId>dcm4che-imageio-opencv</artifactId>
    <version>5.27.0</version>
    <scope>runtime</scope>
</dependency>

<dependency>
    <groupId>org.dcm4che</groupId>
    <artifactId>dcm4che-image</artifactId>
    <version>5.27.0</version>
</dependency>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值