parameters: (im)
return_statement: return mask.astype(dtype=np.int32)
docstring: use a intensity threshold to roughly find the mask of the body
docstring_summary: use a intensity threshold to roughly find the mask of the body
docstring_tokens: use a intensity threshold to roughly find the mask of the body
function: def get_mask(im):
      """use a intensity threshold to roughly find the mask of the body"""
      th = 32000  # an approximate background intensity value
      mask = im > th
      mask = binary_opening(mask, structure=np.ones((7, 7)))  # roughly remove bed
      # mask = binary_dilation(mask)
      # mask = binary_fill_holes(mask, structure=np.ones((11,11)))  # fill parts like lung
  
      if mask.sum() == 0:  # maybe atypical intensity
          mask = im * 0 + 1
      return mask.astype(dtype=np.int32)
function_tokens: def get_mask ( im ) : th = 32000 # an approximate background intensity value mask = im > th mask = binary_opening ( mask , structure = np . ones ( ( 7 , 7 ) ) ) # roughly remove bed # mask = binary_dilation(mask) # mask = binary_fill_holes(mask, structure=np.ones((11,11)))  # fill parts like lung if mask . sum ( ) == 0 : # maybe atypical intensity mask = im * 0 + 1 return mask . astype ( dtype = np . int32 )