def is_cellomics_image(fn):
    """Determine whether a file is a Cellomics image.

    Parameters
    ----------
    fn : string
        The filename of the file in question.

    Returns
    -------
    is_cellom : bool
        True if the filename points to a Cellomics image.
    """
    is_cellom = fn.endswith('.C01') or fn.endswith('.c01')
    return is_cellom


def is_cellomics_mask(fn):
    """Determine whether a file is a Cellomics mask image.

    Parameters
    ----------
    fn : string
        The filename.

    Returns
    -------
    is_mask : bool
        True if the filename points to a Cellomics mask image.
    """
    is_mask = fn.endswith('o1.C01') or fn.endswith('o1.c01')
    return is_mask



import os


def fn_has_ext(fn, ext, case_sensitive=False):
    """
    Determine whether a file has a particular extension.

    Parameters
    ----------
    fn : string
        The filename of the query file.
    ext : string
        The extension being checked.
    case_sensitive : bool
        Whether or not to treat the extension as case sensitive.

    Returns
    -------
    file_has_ext : bool
        True if the filename has the specified extension.
    """
    fn_ext = os.path.splitext(fn)[1][1:]
    if case_sensitive:
        file_has_ext = fn_ext == ext
    else:
        file_has_ext = fn_ext.lower() == ext.lower()
    return file_has_ext


def is_cellomics_image(fn):
    """Determine whether a file is a Cellomics image.

    Parameters
    ----------
    fn : string
        The filename of the file in question.

    Returns
    -------
    is_cellom : bool
        True if the filename points to a Cellomics image.
    """
    is_cellom = fn_has_ext(fn, 'C01') or fn_has_ext(fn, 'DIB')
    return is_cellom


def is_cellomics_mask(fn):
    """Determine whether a file is a Cellomics mask image.

    Parameters
    ----------
    fn : string
        The filename.

    Returns
    -------
    is_mask : bool
        True if the filename points to a Cellomics mask image.
    """
    is_mask = fn.endswith('o1.C01') or fn.endswith('o1.c01')
    return is_mask



Add DIB files to cellomics file filter
Add DIB files to cellomics file filter

+ import os
+ 
+ 
+ def fn_has_ext(fn, ext, case_sensitive=False):
+     """
+     Determine whether a file has a particular extension.
+ 
+     Parameters
+     ----------
+     fn : string
+         The filename of the query file.
+     ext : string
+         The extension being checked.
+     case_sensitive : bool
+         Whether or not to treat the extension as case sensitive.
+ 
+     Returns
+     -------
+     file_has_ext : bool
+         True if the filename has the specified extension.
+     """
+     fn_ext = os.path.splitext(fn)[1][1:]
+     if case_sensitive:
+         file_has_ext = fn_ext == ext
+     else:
+         file_has_ext = fn_ext.lower() == ext.lower()
+     return file_has_ext
+ 
+ 
  def is_cellomics_image(fn):
      """Determine whether a file is a Cellomics image.
  
      Parameters
      ----------
      fn : string
          The filename of the file in question.
  
      Returns
      -------
      is_cellom : bool
          True if the filename points to a Cellomics image.
      """
-     is_cellom = fn.endswith('.C01') or fn.endswith('.c01')
+     is_cellom = fn_has_ext(fn, 'C01') or fn_has_ext(fn, 'DIB')
      return is_cellom
  
  
  def is_cellomics_mask(fn):
      """Determine whether a file is a Cellomics mask image.
  
      Parameters
      ----------
      fn : string
          The filename.
  
      Returns
      -------
      is_mask : bool
          True if the filename points to a Cellomics mask image.
      """
      is_mask = fn.endswith('o1.C01') or fn.endswith('o1.c01')
      return is_mask
  
  
  
Add DIB files to cellomics file filter
## Code Before:
def is_cellomics_image(fn):
    """Determine whether a file is a Cellomics image.

    Parameters
    ----------
    fn : string
        The filename of the file in question.

    Returns
    -------
    is_cellom : bool
        True if the filename points to a Cellomics image.
    """
    is_cellom = fn.endswith('.C01') or fn.endswith('.c01')
    return is_cellom


def is_cellomics_mask(fn):
    """Determine whether a file is a Cellomics mask image.

    Parameters
    ----------
    fn : string
        The filename.

    Returns
    -------
    is_mask : bool
        True if the filename points to a Cellomics mask image.
    """
    is_mask = fn.endswith('o1.C01') or fn.endswith('o1.c01')
    return is_mask



## Instruction:
Add DIB files to cellomics file filter
## Code After:
import os


def fn_has_ext(fn, ext, case_sensitive=False):
    """
    Determine whether a file has a particular extension.

    Parameters
    ----------
    fn : string
        The filename of the query file.
    ext : string
        The extension being checked.
    case_sensitive : bool
        Whether or not to treat the extension as case sensitive.

    Returns
    -------
    file_has_ext : bool
        True if the filename has the specified extension.
    """
    fn_ext = os.path.splitext(fn)[1][1:]
    if case_sensitive:
        file_has_ext = fn_ext == ext
    else:
        file_has_ext = fn_ext.lower() == ext.lower()
    return file_has_ext


def is_cellomics_image(fn):
    """Determine whether a file is a Cellomics image.

    Parameters
    ----------
    fn : string
        The filename of the file in question.

    Returns
    -------
    is_cellom : bool
        True if the filename points to a Cellomics image.
    """
    is_cellom = fn_has_ext(fn, 'C01') or fn_has_ext(fn, 'DIB')
    return is_cellom


def is_cellomics_mask(fn):
    """Determine whether a file is a Cellomics mask image.

    Parameters
    ----------
    fn : string
        The filename.

    Returns
    -------
    is_mask : bool
        True if the filename points to a Cellomics mask image.
    """
    is_mask = fn.endswith('o1.C01') or fn.endswith('o1.c01')
    return is_mask


