Skip to content

How can I change this function to fit my data #31

@gireeshkbogu

Description

@gireeshkbogu

Thank you for the great resource.

I see this function mt_datasets.SCGMChallenge2DTrain was designed to read SCGM challenge data. How can I modify this to fit my own data? For example whenever I use mt_datasets.SCGMChallenge2DTrain, it is throwing the following error. I am assuming this function is written to read input files with the name site-sc*. I have files with different names like case-0000_, case00001_ etc. Now how can I modify this mt_datasets.SCGMChallenge2DTrain function to fit my data?

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/home/gbogu17/.local/lib/python3.7/site-packages/nibabel/loadsave.py in load(filename, **kwargs)
     39     try:
---> 40         stat_result = os.stat(filename)
     41     except OSError:

FileNotFoundError: [Errno 2] No such file or directory: '/labs/mpsnyder/gbogu17/kits_2019/train/site1-sc01-image.nii.gz'

During handling of the above exception, another exception occurred:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-62-97efc63ceae4> in <module>()
      5                                                    subj_ids=range(1, 2),
      6                                                    transform=train_transform,
----> 7                                               slice_filter_fn=mt_filters.SliceFilter())
      8 
      9 # FileNotFoundError: No such file or no access: '/labs/mpsnyder/gbogu17/kits_2019/train/site1-sc01-image.nii.gz'

/home/gbogu17/.local/lib/python3.7/site-packages/medicaltorch/datasets.py in __init__(self, root_dir, slice_axis, site_ids, subj_ids, rater_ids, cache, transform, slice_filter_fn, canonical, labeled)
    399 
    400         super().__init__(self.filename_pairs, slice_axis, cache,
--> 401                          transform, slice_filter_fn, canonical)
    402 
    403     @staticmethod

/home/gbogu17/.local/lib/python3.7/site-packages/medicaltorch/datasets.py in __init__(self, filename_pairs, slice_axis, cache, transform, slice_filter_fn, canonical)
    211         self.canonical = canonical
    212 
--> 213         self._load_filenames()
    214         self._prepare_indexes()
    215 

/home/gbogu17/.local/lib/python3.7/site-packages/medicaltorch/datasets.py in _load_filenames(self)
    217         for input_filename, gt_filename in self.filename_pairs:
    218             segpair = SegmentationPair2D(input_filename, gt_filename,
--> 219                                          self.cache, self.canonical)
    220             self.handlers.append(segpair)
    221 

/home/gbogu17/.local/lib/python3.7/site-packages/medicaltorch/datasets.py in __init__(self, input_filename, gt_filename, cache, canonical)
     74         self.cache = cache
     75 
---> 76         self.input_handle = nib.load(self.input_filename)
     77 
     78         # Unlabeled data (inference time)

/home/gbogu17/.local/lib/python3.7/site-packages/nibabel/loadsave.py in load(filename, **kwargs)
     40         stat_result = os.stat(filename)
     41     except OSError:
---> 42         raise FileNotFoundError("No such file or no access: '%s'" % filename)
     43     if stat_result.st_size <= 0:
     44         raise ImageFileError("Empty file: '%s'" % filename)

FileNotFoundError: No such file or no access: '/labs/mpsnyder/gbogu17/kits_2019/train/site1-sc01-image.nii.gz'

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions