original_docstring: 
      Helper for ACDC data
      
      Expects an 3d-image and -mask file name and a target path
      filter mask and image volumes with segmentation
      copy all metadata
      save them to the destination path
      :param img_f:
      :param mask_f:
      :param full_path:
      :return:
      
docstring: Helper for ACDC data
  Expects an 3d-image and -mask file name and a target path
  filter mask and image volumes with segmentation
  copy all metadata
  save them to the destination path
docstring_tokens: Helper for ACDC data Expects an 3d - image and - mask file name and a target path filter mask and image volumes with segmentation copy all metadata save them to the destination path
code: def create_2d_slices_from_3d_volume_files_new_naming(img_f, mask_f, export_path):
      """
      Helper for ACDC data
      
      Expects an 3d-image and -mask file name and a target path
      filter mask and image volumes with segmentation
      copy all metadata
      save them to the destination path
      :param img_f:
      :param mask_f:
      :param full_path:
      :return:
      """
  
      logging.info('process file: {}'.format(img_f))
  
      # get sitk images
      if not mask_f:
          masks_given = False
          mask_f = img_f
  
      mask_3d_sitk = sitk.ReadImage(mask_f)
      img_3d_sitk = sitk.ReadImage(img_f)
  
      # filter 4d image nda according to given mask nda
  
      mask_3d = sitk.GetArrayFromImage(mask_3d_sitk)
      img_3d = sitk.GetArrayFromImage(img_3d_sitk)
  
      # get patient_name
      patient_name = os.path.basename(img_f).split('_')[0]
      frame = os.path.basename(img_f).split('frame')[1][:2]
      # create z x 2d slices
      for z, slice_2d in enumerate(zip(img_3d, mask_3d)):
          # create filenames with reference to t and z position
          img_file = '{}__t{}_z{}_{}{}'.format('f_' + patient_name, str(frame), str(z), 'img', '.nrrd')
          mask_file = '{}__t{}_z{}_{}{}'.format('f_' + patient_name, str(frame), str(z), 'msk', '.nrrd')
  
          # save nrrd file with metadata
          copy_meta_and_save(slice_2d[0], img_3d_sitk, os.path.join(export_path, img_file))
          copy_meta_and_save(slice_2d[1], img_3d_sitk, os.path.join(export_path, mask_file))
  
      return [frame, list(img_3d.shape)]
code_tokens: def create_2d_slices_from_3d_volume_files_new_naming ( img_f , mask_f , export_path ) : logging . info ( 'process file: {}' . format ( img_f ) ) if not mask_f : masks_given = False mask_f = img_f mask_3d_sitk = sitk . ReadImage ( mask_f ) img_3d_sitk = sitk . ReadImage ( img_f ) mask_3d = sitk . GetArrayFromImage ( mask_3d_sitk ) img_3d = sitk . GetArrayFromImage ( img_3d_sitk ) patient_name = os . path . basename ( img_f ) . split ( '_' ) [ 0 ] frame = os . path . basename ( img_f ) . split ( 'frame' ) [ 1 ] [ : 2 ] for z , slice_2d in enumerate ( zip ( img_3d , mask_3d ) ) : img_file = '{}__t{}_z{}_{}{}' . format ( 'f_' + patient_name , str ( frame ) , str ( z ) , 'img' , '.nrrd' ) mask_file = '{}__t{}_z{}_{}{}' . format ( 'f_' + patient_name , str ( frame ) , str ( z ) , 'msk' , '.nrrd' ) copy_meta_and_save ( slice_2d [ 0 ] , img_3d_sitk , os . path . join ( export_path , img_file ) ) copy_meta_and_save ( slice_2d [ 1 ] , img_3d_sitk , os . path . join ( export_path , mask_file ) ) return [ frame , list ( img_3d . shape ) ]
short_docstring: Helper for ACDC data
  Expects an 3d-image and -mask file name and a target path
  filter mask and image volumes with segmentation
  copy all metadata
  save them to the destination path
short_docstring_tokens: Helper for ACDC data Expects an 3d - image and - mask file name and a target path filter mask and image volumes with segmentation copy all metadata save them to the destination path
comment: """
      Helper for ACDC data
      
      Expects an 3d-image and -mask file name and a target path
      filter mask and image volumes with segmentation
      copy all metadata
      save them to the destination path
      :param img_f:
      :param mask_f:
      :param full_path:
      :return:
      """$SEP$# get sitk images$SEP$# filter 4d image nda according to given mask nda$SEP$# get patient_name$SEP$# create z x 2d slices$SEP$# create filenames with reference to t and z position$SEP$# save nrrd file with metadata