背景
kaggleのsiim-covid19-detectionコンペの画像読み込み方法がよくわからなかったので、調べたログです。環境はGoogle Colaboratoryを使用しています。
また、データをkaggle APIで取得する部分は以下の記事にまとめています。
記事名:kaggleコンペのデータ取得 (Google Colaboratory)
実施内容
# pydicomのインストール
!pip install pydicom
指定ファイルの読込
import pydicom
%cd /content/drive/My Drive/data/kaggle/siim-covid19-detection/
example_file = pydicom.dcmread("3fadf4b48db3.dcm")
example_image = example_file.pixel_array
データの表示
from matplotlib import pyplot as plt
plt.imshow(example_file.pixel_array)