class_docstr: Holds the path to mask image file.
  
  # Arguments
      filepath: Path to the mask image file.
code: def to_mask(self, h, w, pad_dim=True):
      # TODO: convert the 255 masks
      mask = open_img(self.filepath, gray=True)
  
      # If the dimensions provided in h and w do not match the size of the mask, resize the mask accordingly
      (w_org, h_org) = mask.size
  
      # TODO: Check NEAREST is always the best option or only for binary?
      if w_org != w or h_org != h:
          mask = mask.resize((w, h), resample=PIL.Image.NEAREST)
  
      # HACK: because open_img now return PIL
      mask = np.array(mask)
  
      # convert 255 pixels to 1
      if self.binary:
          mask[mask == 255] = 1
  
      # control array padding behaviour
      return MaskArray(mask, pad_dim=pad_dim)
  
imports: from icevision.imports import *
  from icevision.utils import *
  from PIL import Image
label_desc: Use image node_id 2 for calling the SemanticMaskFile obj's underlying member method code with example usage: obj.to_mask(h, w, pad_dim) and returns: MaskArray