Project/[Landmark Detection] RL

3D medical image Data-Augmentation

HJChung 2021. 5. 15. 00:53

3D Data-Augmentation Using tf.data and Volumentations-3D Library 글에서 나와 있듯이

  1. NiftyNet is a TensorFlow-based open-source convolutional neural networks platform for research in medical image analysis and image-guided therapy.
  2. DLTK is an open-source library that makes deep learning on medical images easier, build on Tensorflow.
  3. MONAI framework is the open-source foundation being created by Project MONAI. MONAI is a freely available, community-supported, PyTorch-based framework for deep learning in healthcare imaging.
  4. MedicalTorch is an open-source framework for PyTorch, implementing an extensive set of loaders, pre-processors, and datasets for medical imaging.
  5. SimpleITK is an abstraction layer and wrapper around the Insight Segmentation and Registration Toolkit (ITK). It is available in the following programming languages: C++, Python, R, Java, C#, Lua, Tcl, and Ruby. [http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/70_Data_Augmentation.html ]

이러한 방법이 있고, 이 중 나는 MONAI가 offline방식으로 augmentation을 진행하기 가장 쉬웠다. 

https://github.com/Project-MONAI/tutorials/blob/master/modules/3d_image_transforms.ipynb

 

Project-MONAI/tutorials

MONAI Tutorials. Contribute to Project-MONAI/tutorials development by creating an account on GitHub.

github.com

 

그리고 Augmentation using intensity modifications을 하는 경우에는 landmark 좌표가 변하는 issue가 없기 때문에 online으로 진행 할 수 있을 것 같고, 그 때는 data read와 resample등에 사용하고 있는 simpleITK를 사용하여 data read 할 때 바로 online으로 augmentation을 진행해도 좋을 것 같다. 

https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/70_Data_Augmentation.ipynb

 

offline으로 nifti파일 불러와서, 이미지 프로세싱하고 저장하는 것은 아래의 코드를 참고했다. 

https://nipy.org/nibabel/nibabel_images.html

import nibabel as nib

mri = nib.load('p1_mri_t1.nii.gz')

img = mri.get_fdata()


# image processing
imgd = img + img


mri_new = nib.Nifti1Image(imgd, mri.affine, mri.header)

nib.save(mri_new,'p1_mri_t1_new.nii.gz')