neheller / kits19

The official repository of the 2019 Kidney and Kidney Tumor Segmentation Challenge
Other
432 stars 178 forks source link

Trouble obtaining data #62

Closed WillX1998 closed 3 years ago

WillX1998 commented 3 years ago

Hi,

Does anyone know how to access the actual image data, not the segmentation images, without using Python? I'm trying to do my own segmentation using MATLAB.

Thank you.

neheller commented 3 years ago

I'm not very familiar with MATLAB. Are you able to run bash? This script should be able to download the imaging data. Make sure to run it from the repository root.

#!/bin/bash
if [ ! -d "data" ]
then
  mkdir data
fi
for I in {0..299}
do
  DSTP=$(printf "data/case_%05d" $I)
  DSTF=$(printf "data/case_%05d/imaging.nii.gz" $I)
  if [ ! -d $DSTP ]
  then
    mkdir $DSTP
  fi
  if [ ! -f $DSTF ]
  then
    wget https://kits19.sfo2.digitaloceanspaces.com/master_$(printf "%05d" $I).nii.gz
    mv master_$(printf "%05d" $I).nii.gz $DSTF
  fi
done
WillX1998 commented 3 years ago

Hi,

Thank you for responding. I've never used Bash before. Is that the only way to download the imaging data?

WillX1998 commented 3 years ago

Can you please walk me through using Git Bash to download the images? I tried running the code and it said the images were not found.

neheller commented 3 years ago

I'm not sure why the images wouldn't be found since it works on my end. There must be some other problem when using the above with Git Bash. How about the following MATLAB script?

if ~exist('data', 'dir')
    mkdir('data');
end
for i = 0:299
    case_dir = fullfile('data', sprintf('case_%05d', i));
    if ~exist(case_dir, 'dir')
        mkdir(case_dir);
    end
    websave(fullfile(case_dir, 'imaging.nii.gz'), sprintf('https://kits19.sfo2.digitaloceanspaces.com/master_%05d.nii.gz', i), 'timeout',20);
end
WillX1998 commented 3 years ago

Hi I managed to get the images. Thank you!