免費工具

CTP DICOM Anonymizer Tool 影像去識別化指令工具教學與範例

介紹如何使用 CTP 的 DICOM Anonymizer Tool 指令工具,對 DICOM 影像進行去識別化處理。

DicomAnonymizerTool 是一個包含 CTP DicomFilterDicomPixeAnonymizerDicomAnonymizer 去識別化功能的指令工具,可以對單一 DICOM 影像檔案或整個目錄進行去識別化處理,對於有自動化批次處理需求的使用者來說,可以將此工具整合至自己的程式或指令稿中。

下載與安裝 DICOM Anonymizer Tool

DICOM Anonymizer Tool 是以 Java 開發的指令工具,使用前請先安裝好 Java 執行環境(JRE)。

RSNA MIRC 網站上下載 DicomAnonymizerTool 的 JAR 安裝檔進行安裝,並選擇安裝路徑:

# 下載 DicomAnonymizerTool-installer.jar
wget http://mirc.rsna.org/download/DicomAnonymizerTool-installer.jar

# 安裝 Dicom Anonymizer Tool
java -jar DicomAnonymizerTool-installer.jar

安裝完成之後,進入 DicomAnonymizerTool 安裝目錄,執行 DAT.jar 不帶任何參數,可以顯示各參數的使用方式:

# 查詢使用方式
java -jar DAT.jar
Usage: java -jar DAT.jar {parameters}
where:
  -in {input} specifies the file or directory to be anonymized
       If {input} is a directory, all files in it and its subdirectories are processed.
  -out {output} specifies the file or directory in which to store the anonymized file or files.
       If -out is missing and -in specifies a file, the anonymized file is named {input}-an.
       If -out is missing and -in specifies a directory, an output directory named {input}-an is created.
       If {output} is missing and -in specifies a file, the anonymized file overwrites {input}
       If {output} is present and -in specifies a file, the anonymized file is named {output}
       If {output} is present and -in specifies a directory, an output directory named {output} is created.
  -f {scriptfile} specifies the filter script.
       If -f is missing, all files are accepted.
       If {scriptfile} is missing, the default script is used.
  -da {scriptfile} specifies the anonymizer script.
       If -da is missing, element anonymization is not performed.
       If {scriptfile} is missing, the default script is used.
  -p{param} "{value}" specifies a value for the specified parameter.
       {value} must be encapsulated in quotes.
  -e{element} "{script}" specifies a script for the specified element.
       {element} may be specified as a DICOM keyword, e.g. -ePatientName.
       {element} may be specified as (group,element), e.g. -e(0010,0010).
       {element} may be specified as [group,element], e.g. -e[0010,0010].
       {element} may be specified as groupelement, e.g. -e00100010.
       {script} must be encapsulated in quotes.
  -lut {lookuptablefile} specifies the anonymizer lookup table properties file.
       If -lut is missing, the default lookup table is used.
  -dpa {pixelscriptfile} specifies the pixel anonymizer script file.
       If -dpa is missing, pixel anonymization is not performed.
       If {pixelscriptfile} is missing, the default pixel script is used.
  -dec specifies that the image is to be decompressed if the pixel anonymizer requires it.
  -rec specifies that the image is to be recompressed after pixel anonymization if it was decompressed.
  -test specifies that the pixel anonymizer is to blank regions in mid-gray.
  -check {frame} specifies that the anonymized image is to be tested to ensure that the images load.
       If -check is missing, no frame checking is done.
       If {frame} is missing, only the last frame is checked.
       If {frame} is specified as first, only the first frame is checked.
       If {frame} is specified as last, only the last frame is checked.
       If {frame} is specified as all, all frames are checked.
  -n {threads} specifies the number of parallel threads used for processing.
  -v specifies verbose output

Configuration:
os.name:               Linux
java.version:          11.0.11
sun.arch.data.model:   64
java.home:             /usr/lib/jvm/java-11-openjdk-amd64
clib:                  null
jai:                   null
jiio:                  null
jiio sse2:             null
jiio util:             null
ImageIO Tools version: null

Available codecs:
R/W BMP
R/W DICOM
R/W GIF
R/W JPEG
R   JPEG-LOSSLESS
R/W JPEG2000
R/W JPG
R/W PCX
R/W PNG
R/W PNM
R/W RAW
R   RLE
R/W TIFF
R/W WBMP

DICOM 影像去識別化

若要對 DICOM 影像進行基本的去識別化,可以用 -in-out 分別指定輸入與輸出的檔案或目錄,並以 -da 指定 DicomAnonymizer 去識別化規則的指令稿:

# 進行 DICOM 影像去識別化
java -jar DAT.jar -in input.dcm -out output.dcm -da dicom-anonymizer.script
----
Thread: pool-1-thread-1: Anonymizing input.dcm
   Anonymized file: output.dcm
----
Elapsed time: 0.460

對於一般的使用者來說,在選擇 DicomAnonymizer 去識別化規則時,建議下載 CTP 並安裝之後,使用其 profiles/dicom 目錄中附帶的 profile 指令稿範本,裡面包含標準的 DICOM PS3.15 Basic Application Level Confidentiality Profile 以及搭配各種 Basic Application Level Confidentiality Options 的指令稿,另外也提供了 TCIA 所採用的指令稿,這些標準的指令稿都依循了 DICOM 的標準規範,可以確保去識別化之後的影像也都能符合 DICOM 標準。

CTP 附帶的去識別化 Profile 指令稿

關於 DicomAnonymizer 去識別化規則的指令稿語法,可以參考 CTP DICOM Anonymizer 的說明文件

DICOM 影像像素去識別化

若要同時對 DICOM 影像的像素(pixel)內容進行去識別化,抹除烙印在影像中的個人資料,可以使用 -dpa 指定 DICOM Pixel Anonymizer 的指令稿:

# 同時對 DICOM 影像像素進行去識別化
java -jar DAT.jar \
  -in  input.dcm \
  -out output.dcm \
  -da  dicom-anonymizer.script \
  -dpa dicom-pixel-anonymizer.script

如果遇到壓縮過的 DICOM 影像,必須要先進行解壓縮後,才能進行 DICOM Pixel Anonymizer 去識別化處理,加上 -dec 參數可以在必要時自動解壓縮,而若加上 -rec 參數則可在 DICOM Pixel Anonymizer 去識別化處理之後,自動重新壓縮影像。

# 同時對 DICOM 影像像素進行去識別化,自動解壓縮與重新壓縮
java -jar DAT.jar \
  -in  input.dcm \
  -out output.dcm \
  -da  dicom-anonymizer.script \
  -dpa dicom-pixel-anonymizer.script \
  -dec -rec

若加上 -test 參數,可以讓 DICOM Pixel Anonymizer 以淺色的方式覆蓋個資區域,以方便測試與除錯。

# 同時對 DICOM 影像像素進行去識別化,以淺色覆蓋個資區域
java -jar DAT.jar \
  -in  input.dcm \
  -out output.dcm \
  -da  dicom-anonymizer.script \
  -dpa dicom-pixel-anonymizer.script \
  -test

進階去識別化設定

DicomAnonymizerTool 也可以搭配 DICOM FilterDICOM AnonymizerDICOM Pixel Anonymizer對照表(lookup table)一起使用。

# 進行 DICOM 影像去識別化
java -jar DAT.jar \
  -in  input.dcm \
  -out output.dcm \
  -f   dicom-filter.script \
  -da  dicom-anonymizer.script \
  -dpa dicom-pixel-anonymizer.script \
  -lut lookup-table.properties

Recent Posts

Python 使用 PyAutoGUI 自動操作滑鼠與鍵盤

本篇介紹如何在 Python ...

9 個月 ago

Ubuntu Linux 以 WireGuard 架設 VPN 伺服器教學與範例

本篇介紹如何在 Ubuntu ...

9 個月 ago

Linux 網路設定 ip 指令用法教學與範例

本篇介紹如何在 Linux 系...

9 個月 ago

Windows 使用 TPM 虛擬智慧卡保護 SSH 金鑰教學與範例

本篇介紹如何在 Windows...

10 個月 ago

Linux 以 Shamir’s Secret Sharing 分割保存金鑰教學與範例

介紹如何在 Linux 中使用...

10 個月 ago

Linux 以 Cryptsetup、LUKS 加密 USB 隨身碟教學與範例

介紹如何在 Linux 系統中...

10 個月 ago