code: def make_btech_dataset(
      path: Path, split: str | Split | None = None
  ) -> DataFrame:
      """Create BTech samples by parsing the BTech data file structure.
  
      The files are expected to follow the structure:
          path/to/dataset/split/category/image_filename.png
          path/to/dataset/ground_truth/category/mask_filename.png
  
      Args:
          path (Path): Path to dataset
          split (str | Split | None, optional): Dataset split (ie., either train or test). Defaults to None.
          split_ratio (float, optional): Ratio to split normal training images and add to the
              test set in case test set doesn't contain any normal images.
              Defaults to 0.1.
          seed (int, optional): Random seed to ensure reproducibility when splitting. Defaults to 0.
          create_validation_set (bool, optional): Boolean to create a validation set from the test set.
              BTech dataset does not contain a validation set. Those wanting to create a validation set
              could set this flag to ``True``.
  
      Example:
          The following example shows how to get training samples from BTech 01 category:
  
          >>> root = Path('./BTech')
          >>> category = '01'
          >>> path = root / category
          >>> path
          PosixPath('BTech/01')
  
          >>> samples = make_btech_dataset(path, split='train', split_ratio=0.1, seed=0)
          >>> samples.head()
             path     split label image_path                  mask_path                     label_index
          0  BTech/01 train 01    BTech/01/train/ok/105.bmp BTech/01/ground_truth/ok/105.png      0
          1  BTech/01 train 01    BTech/01/train/ok/017.bmp BTech/01/ground_truth/ok/017.png      0
          ...
  
      Returns:
          DataFrame: an output dataframe containing samples for the requested split (ie., train or test)
      """
      samples_list = [
          (str(path),) + filename.parts[-3:]
          for filename in path.glob("**/*")
          if filename.suffix in (".bmp", ".png")
      ]
      if not samples_list:
          raise RuntimeError(f"Found 0 images in {path}")
  
      samples = pd.DataFrame(
          samples_list, columns=["path", "split", "label", "image_path"]
      )
      samples = samples[samples.split != "ground_truth"]
  
      # Create mask_path column
      # (safely handles cases where non-mask image_paths end with either .png or .bmp)
      samples["mask_path"] = (
          samples.path
          + "/ground_truth/"
          + samples.label
          + "/"
          + samples.image_path.str.rstrip("png")
          .str.rstrip(".")
          .str.rstrip("bmp")
          .str.rstrip(".")
          + ".png"
      )
  
      # Modify image_path column by converting to absolute path
      samples["image_path"] = (
          samples.path
          + "/"
          + samples.split
          + "/"
          + samples.label
          + "/"
          + samples.image_path
      )
  
      # Good images don't have mask
      samples.loc[
          (samples.split == "test") & (samples.label == "ok"),
          "mask_path",
      ] = ""
  
      # Create label index for normal (0) and anomalous (1) images.
      samples.loc[
          (samples.label == "ok"), "label_index"
      ] = LabelName.NORMAL
      samples.loc[
          (samples.label != "ok"), "label_index"
      ] = LabelName.ABNORMAL
      samples.label_index = samples.label_index.astype(int)
  
      # Get the data frame for the split.
      if split:
          samples = samples[samples.split == split]
          samples = samples.reset_index(drop=True)
  
      return samples
  
imports: from __future__ import annotations
  import logging
  import shutil
  from pathlib import Path
  import albumentations
  import cv2
  import pandas
  from pandas.core.frame import DataFrame
  from tqdm import tqdm
  from anomalib.data.base import AnomalibDataModule, AnomalibDataset
  from anomalib.data.task_type import TaskType
  from anomalib.data.utils import DownloadInfo, InputNormalizationMethod, LabelName, Split, TestSplitMode, ValSplitMode, download_and_extract, get_transforms
label_desc: Use image node_id 1 for calling a global function with example usage: make_btech_dataset(path, split) and returns: samples