Datasets:
Preparing SKM-TEA Data
MedVision is designed to download raw data from source and the annotations from our Huggingface dataset repo. For access to the raw data of the SKM-TEA dataset, you need to register at https://aimi.stanford.edu/datasets/skm-tea-knee-mri.
This tutorial is about:
- What data to download from the source in order to use the annotations from MedVision?
- How to preprocess the raw data?
- How to structure the preprocessed files?
What data to download?
- Download images from
dicoms - Download masks from
segmentation_masks/raw-data-tracktoMasks
# Files from SKM-TEA source
βββ v1-release
βββ dicoms
βββ MTR_001.tar.gz
βββ ...
βββ segmentation_masks
βββ raw-data-track
βββ MTR_001.nii.gz
βββ ...
# local file structure
βββ [your folder]
βββ Masks
βββ MTR_001.nii.gz
βββ ...
βββ dicoms
βββ MTR_001.tar.gz
βββ ...
How to preprocess data?
β οΈ DO NOT change file or folder names. See why here.
Go to the parent folder of
dicoms, installdcm2niix, add processing script# local file structure βββ [your folder] βββ Masks βββ dicoms βββ prepare-skm-tea.sh # <-- add this# prepare-skm-tea.sh # Step 1: extract files mkdir -p dicoms-ext for f in dicoms/*.tar.gz; do tar -xvzf "$f" -C dicoms-ext done # Step 2: convert dcm to nii.gz mkdir -p niigz for d in dicoms-ext/MTR_*; do dcm2niix -z y -f %f -o niigz/ $d done # Step 3: move files mkdir -p Images-E1 Images-E2 for f in niigz/*_e1.nii.gz; do base=$(basename "$f") # remove path prefix mv "$f" "Images-E1/${base/_e1/}" # rename and move done for f in niigz/*_e2.nii.gz; do base=$(basename "$f") mv "$f" "Images-E2/${base/_e2/}" done # clean up rm -r niigz rm -r dicoms-extExpected file structure after running
bash prepare-skm-tea.sh# local file structure βββ [your folder] βββ Masks βββ dicoms βββ Images-E1 βββ Images-E2 βββ prepare-skm-tea.shPut these folders into
SKM-TEA-niiand upload the compressed file to your HF dataset repo# DO NOT use other folder names βββ SKM-TEA-nii βββ Images-E1 βββ Images-E2 βββ MasksYour HF repo should contain
SKM-TEA-nii.zipSet env var whenever you load SKM-TEA data from MedVision
import os os.environ["MedVision_SKMTEA_HF_ID"] = <your-hf-dataset-id>