original_docstring: generator to build the training record
docstring: generator to build the training record
docstring_tokens: generator to build the training record
code: def _data_gen(self, inputs):
          '''generator to build the training record'''
  
          logger = logging.getLogger('luigi-interface')
  
          for idx, subdf in inputs:
  
              raw_row = subdf.query(self.raw_filter)
              annot_row = subdf.query(self.annot_filter)
  
              if not (len(raw_row) == 1 and len(annot_row) == 1):
                  continue
  
              logger.info(
                  'adding raw|annot pair to training record: {} - {} to {}'.
                  format(raw_row.dc.path[0], annot_row.dc.path[0],
                         self.record_name))
  
              raw = raw_row.dc.read()[0]
              annot = annot_row.dc.read()[0]
  
              raw = match_spacing(
                  raw,
                  1, (self.input_downsampling, self.input_downsampling, 1),
                  image_type='greyscale')
              annot = match_spacing(annot,
                                    1,
                                    self.input_downsampling,
                                    image_type='label_nearest')
  
              #normalize input image
              raw = standardize(raw)
  
              # replace annot by smooth map
              annot = smooth_separator(annot == 2)
  
              # add channel dim
              yield raw, annot[..., None]
code_tokens: def _data_gen ( self , inputs ) : logger = logging . getLogger ( 'luigi-interface' ) for idx , subdf in inputs : raw_row = subdf . query ( self . raw_filter ) annot_row = subdf . query ( self . annot_filter ) if not ( len ( raw_row ) == 1 and len ( annot_row ) == 1 ) : continue logger . info ( 'adding raw|annot pair to training record: {} - {} to {}' . format ( raw_row . dc . path [ 0 ] , annot_row . dc . path [ 0 ] , self . record_name ) ) raw = raw_row . dc . read ( ) [ 0 ] annot = annot_row . dc . read ( ) [ 0 ] raw = match_spacing ( raw , 1 , ( self . input_downsampling , self . input_downsampling , 1 ) , image_type = 'greyscale' ) annot = match_spacing ( annot , 1 , self . input_downsampling , image_type = 'label_nearest' ) raw = standardize ( raw ) annot = smooth_separator ( annot == 2 ) yield raw , annot [ ... , None ]
short_docstring: generator to build the training record
short_docstring_tokens: generator to build the training record
comment: '''generator to build the training record'''$SEP$#normalize input image$SEP$# replace annot by smooth map$SEP$# add channel dim