original_docstring: 
      reads all nrrd images/ masks within a train, val, test folder 
      returns a dataframe with all image data
      plots a histogram for every 10th volume
      
docstring: reads all nrrd images/ masks within a train, val, test folder
  returns a dataframe with all image data
  plots a histogram for every 10th volume
docstring_tokens: reads all nrrd images / masks within a train val test folder returns a dataframe with all image data plots a histogram for every 10th volume
code: def describe_path(path='data/processed/train/', dataset=['ACDC', 'GCN'], wildcard=None, plot_histogram=True):
      """
      reads all nrrd images/ masks within a train, val, test folder 
      returns a dataframe with all image data
      plots a histogram for every 10th volume
      """
  
      files = pd.DataFrame()
  
      if wildcard:
          logging.info('Using wildcard description: {}'.format(wildcard))
          files['images'] = sorted(glob.glob(os.path.join(path, wildcard)))
  
      elif dataset == 'ACDC':
          logging.info('Using acdc dataset')
          files['images'] = sorted(glob.glob(os.path.join(path, '**/*frame[0-9][0-9].nii.gz'), recursive=True))
          files['masks'] = sorted(glob.glob(os.path.join(path, '**/*frame*_gt.nii.gz'), recursive=True))
  
      elif dataset == 'GCN':
          logging.info('Using GCN dataset')
          files['images'] = sorted(glob.glob(os.path.join(path, '*clean.nrrd')))
          files['masks'] = sorted(glob.glob(os.path.join(path, '*mask.nrrd')))
          if len(files) == 0:
              files['images'] = sorted(glob.glob(os.path.join(path, '*img.nrrd')))
              files['masks'] = sorted(glob.glob(os.path.join(path, '*msk.nrrd')))
          if len(files) == 0:
              logging.info('search in subfolders ...')
              files['images'] = sorted(glob.glob(os.path.join(path, '**/*img.nrrd')))
              files['masks'] = sorted(glob.glob(os.path.join(path, '**/*msk.nrrd')))
          if len(files) == 0:
              logging.info('no files found, maybe image and mask subfolders, checking ...')
              files['images'] = sorted(glob.glob(os.path.join(path, '**/images/*.nrrd')))
              files['masks'] = sorted(glob.glob(os.path.join(path, '**/masks/*.nrrd')))
  
      logging.info('describing path: {}'.format(path))
  
      assert (len(files) > 0), 'No files found!'
  
      i = 0
      rows = []
      for i, f in enumerate(files['images']):
          logging.debug('Image {} of {}'.format(i, len(files['images'])))
          if i % 10 == 0:
              rows.append(describe_volume(f, plot=plot_histogram))
          else:
              rows.append(describe_volume(f, plot=False))
      if not wildcard:
          for j, f in enumerate(files['masks']):
              logging.debug('Mask {} of {}'.format(j, len(files['masks'])))
              if j % 10 == 0:
                  rows.append(describe_volume(f, image=False, plot=plot_histogram))
              else:
                  rows.append(describe_volume(f, image=False, plot=False))
  
      df_train = pd.DataFrame(rows)
      return df_train
code_tokens: def describe_path ( path = 'data/processed/train/' , dataset = [ 'ACDC' , 'GCN' ] , wildcard = None , plot_histogram = True ) : files = pd . DataFrame ( ) if wildcard : logging . info ( 'Using wildcard description: {}' . format ( wildcard ) ) files [ 'images' ] = sorted ( glob . glob ( os . path . join ( path , wildcard ) ) ) elif dataset == 'ACDC' : logging . info ( 'Using acdc dataset' ) files [ 'images' ] = sorted ( glob . glob ( os . path . join ( path , '**/*frame[0-9][0-9].nii.gz' ) , recursive = True ) ) files [ 'masks' ] = sorted ( glob . glob ( os . path . join ( path , '**/*frame*_gt.nii.gz' ) , recursive = True ) ) elif dataset == 'GCN' : logging . info ( 'Using GCN dataset' ) files [ 'images' ] = sorted ( glob . glob ( os . path . join ( path , '*clean.nrrd' ) ) ) files [ 'masks' ] = sorted ( glob . glob ( os . path . join ( path , '*mask.nrrd' ) ) ) if len ( files ) == 0 : files [ 'images' ] = sorted ( glob . glob ( os . path . join ( path , '*img.nrrd' ) ) ) files [ 'masks' ] = sorted ( glob . glob ( os . path . join ( path , '*msk.nrrd' ) ) ) if len ( files ) == 0 : logging . info ( 'search in subfolders ...' ) files [ 'images' ] = sorted ( glob . glob ( os . path . join ( path , '**/*img.nrrd' ) ) ) files [ 'masks' ] = sorted ( glob . glob ( os . path . join ( path , '**/*msk.nrrd' ) ) ) if len ( files ) == 0 : logging . info ( 'no files found, maybe image and mask subfolders, checking ...' ) files [ 'images' ] = sorted ( glob . glob ( os . path . join ( path , '**/images/*.nrrd' ) ) ) files [ 'masks' ] = sorted ( glob . glob ( os . path . join ( path , '**/masks/*.nrrd' ) ) ) logging . info ( 'describing path: {}' . format ( path ) ) assert ( len ( files ) > 0 ) , 'No files found!' i = 0 rows = [ ] for i , f in enumerate ( files [ 'images' ] ) : logging . debug ( 'Image {} of {}' . format ( i , len ( files [ 'images' ] ) ) ) if i % 10 == 0 : rows . append ( describe_volume ( f , plot = plot_histogram ) ) else : rows . append ( describe_volume ( f , plot = False ) ) if not wildcard : for j , f in enumerate ( files [ 'masks' ] ) : logging . debug ( 'Mask {} of {}' . format ( j , len ( files [ 'masks' ] ) ) ) if j % 10 == 0 : rows . append ( describe_volume ( f , image = False , plot = plot_histogram ) ) else : rows . append ( describe_volume ( f , image = False , plot = False ) ) df_train = pd . DataFrame ( rows ) return df_train
short_docstring: reads all nrrd images/ masks within a train, val, test folder
  returns a dataframe with all image data
  plots a histogram for every 10th volume
short_docstring_tokens: reads all nrrd images / masks within a train val test folder returns a dataframe with all image data plots a histogram for every 10th volume
comment: """
      reads all nrrd images/ masks within a train, val, test folder 
      returns a dataframe with all image data
      plots a histogram for every 10th volume
      """