DICOM 파일을 로드 하려면, itk-wasm 라이브러리에서 제공하는 readImageDICOMFileSeries 함수를 사용해야 합니다.
itk-wasm 설치후 진행하겠습니다.
npm install itk-wasm
실행코드는 아래와 같습니다. DICOM 파일을 여러개 선택하면 해당 파일의 정보를 출력해주는 프로그램입니다.
<template>
<div>
<input type="file" @change="onchange" multiple>
</div>
</template>
<script setup>
import {readImageDICOMFileSeries} from 'itk-wasm'
function onchange(evt){
// 선택된 파일 객체 가져오기
var files = evt.target.files;
// 업로드한 DICOM 파일 정보 출력하기
console.log(files)
// DICOM 파일들 로드
readImageDICOMFileSeries(files)
.then(function({image, webWorker}){
// DICOM 파일을 이미지 파일로 변경후 정보 출력하기
console.log('image');
console.log(image);
// 실행시 내부적으로 계산에 사용된 webWorker가 존재하면 종료시켜 준다.
// itk-wasm API문서 입출력 부분 참조
if(webWorker != null){
webWorker.terminateWorkers();
}
})
.catch(error => {
console.log(error)
})
}
</script>
'3D Graphics > VTK' 카테고리의 다른 글
대용량 image 파일 서버 전송(예정) (0) | 2022.06.15 |
---|---|
vtkImageData 구조 (0) | 2022.06.12 |
Python 개발 환경 설정 (0) | 2022.03.28 |