class_docstr: Performs skull-stripping using a model trained in DeepNeuro.
      
class_docstr_tok: ["Performs","skull-stripping","using","a","model","trained","in","DeepNeuro","."]
code: def execute(self, data_collection, return_array=False):
      if self.mask_numpy is None:
          for label, data_group in list(
              data_collection.data_groups.items()
          ):
              input_data = {
                  "input_data": np.take(
                      data_group.preprocessed_case,
                      self.reference_channel,
                      axis=-1,
                  )[np.newaxis, ...]
              }
  
              # Hacky -- TODO: Revise.
              self.model.outputs[-1].model = self.model
              self.model.outputs[-1].input_patch_shape = (
                  self.model.outputs[-1]
                  .model.model.layers[0]
                  .input_shape
              )
              self.model.outputs[-1].process_case(input_data)
              self.model.outputs[-1].postprocess(input_data)
  
              reference_filename = data_group.data[
                  data_collection.current_case
              ][self.reference_channel[0]]
              self.mask_filename = self.generate_output_filename(
                  reference_filename, self.mask_string
              )
              save_numpy_2_nifti(
                  np.squeeze(self.model.outputs[-1].return_objects[-1]),
                  self.mask_filename,
                  data_group.preprocessed_affine,
              )  # Hacky
  
          self.mask_numpy = read_image_files(
              self.mask_filename, return_affine=False
          )
  
      super(SkullStrip_Model, self).execute(
          data_collection, return_array
      )
  
file_path: DeepNeuro/deepneuro/preprocessing/skullstrip.py
imports: import subprocess
  import os
  import numpy
  from deepneuro.preprocessing.preprocessor import Preprocessor
  from deepneuro.utilities.conversion import read_image_files, save_numpy_2_nifti
  from deepneuro.utilities.util import add_parameter, quotes
  from deepneuro.outputs.segmentation import PatchesInference
  from deepneuro.postprocessing.label import BinarizeLabel, FillHoles, LargestComponents
  from deepneuro.models.model import load_model_with_output
label_desc: Use image node_id 3 for calling the SkullStrip_Model obj's underlying member method code with example usage: obj.execute(data_collection, return_array) without return types