docstr: This function serves operates the main logic of preprocessors.
  Its purpose is to check if data needs to be saved to disk before
  preprocessing (e.g. by an external program), or load data from
  disk if it is to be processed in Python. After processing data
  it can similarly return data in memory or on disk.
docstr_tok: ["This","function","serves","operates","the","main","logic","of","preprocessors",".","Its","purpose","is","to","check","if","data","needs","to","be","saved","to","disk","before","preprocessing","(","e.g",".","by","an","external","program",")",",","or","load","data","from","disk","if","it","is","to","be","processed","in","Python",".","After","processing","data","it","can","similarly","return","data","in","memory","or","on","disk","."]
code: def execute(self, data_collection, return_array=False):
      """This function serves operates the main logic of preprocessors.
      Its purpose is to check if data needs to be saved to disk before
      preprocessing (e.g. by an external program), or load data from
      disk if it is to be processed in Python. After processing data
      it can similarly return data in memory or on disk.
      """
  
      if self.verbose:
          docker_print("Working on Preprocessor:", self.name)
  
      for label, data_group in self.data_groups_iterator:
          self.generate_output_filenames(data_collection, data_group)
  
          if (
              self.array_input
              and type(data_group.preprocessed_case) is list
          ):
              (
                  data_group.preprocessed_case,
                  data_group.preprocessed_affine,
              ) = data_group.get_data(return_affine=True)
          elif (
              not self.array_input
              and type(data_group.preprocessed_case) is list
          ):
              pass
          elif not self.array_input:
              self.output_data = data_group.preprocessed_case
              self.save_to_file(data_group)
              data_group.preprocessed_case = self.output_filenames
  
          self.preprocess(data_group)
  
          if self.save_output:
              self.save_to_file(data_group)
  
          if return_array:
              self.convert_to_array_data(data_group)
  
imports: import os
  import numpy
  from deepneuro.utilities.util import add_parameter, replace_suffix, cli_sanitize, docker_print
  from deepneuro.utilities.conversion import read_image_files, save_data
label_desc: Use image node_id 3 for calling the Preprocessor obj's underlying member method code with example usage: obj.execute(data_collection, return_array) without return types