項目使用中需要解析下載過來的Dicom文件,然後根據固定的層級結構給文件分目錄。以下是代碼:
/**
* <p>
* Title: GetDicomTag
* </p>
*
* <p>
* Description:解析DICOM文件獲取屬性值
* </p>
*
* @author yangzhen
* @date 2018年4月2日
*/
public class GetDicomTag {
public static String getDicomTag(File file, int TagParam) {
InputStream inputStream = null;
DicomInputStream dicomInputStream = null;
String result = "";
try {
inputStream = FileUtils.openInputStream(file);
dicomInputStream = new DicomInputStream(inputStream);
DicomObject dicomObject = dicomInputStream.readDicomObject();
if (dicomObject != null) {
result = dicomObject.getString(TagParam);
return result;
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (dicomInputStream != null) {
dicomInputStream.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ex) {
// logger
}
}
return result;
}
根據Dicom的Tag屬性獲取想要的值,Tag文件在這裏下載
https://download.csdn.net/download/wuyu5649/10713109