class_docstr: Loads image/segmentation pairs of files from the given filename lists. Transformations can be specified
  for the image and segmentation arrays separately.
  The difference between this dataset and `ArrayDataset` is that this dataset can apply transform chain to images
  and segs and return both the images and metadata, and no need to specify transform to load images from files.
  For more information, please see the image_dataset demo in the MONAI tutorial repo,
  https://github.com/Project-MONAI/tutorials/blob/master/modules/image_dataset.ipynb
docstr: Initializes the dataset with the image and segmentation filename lists. The transform `transform` is applied
  to the images and `seg_transform` to the segmentations.
  
  Args:
      image_files: list of image filenames.
      seg_files: if in segmentation task, list of segmentation filenames.
      labels: if in classification task, list of classification labels.
      transform: transform to apply to image arrays.
      seg_transform: transform to apply to segmentation arrays.
      label_transform: transform to apply to the label data.
      image_only: if True return only the image volume, otherwise, return image volume and the metadata.
      transform_with_metadata: if True, the metadata will be passed to the transforms whenever possible.
      dtype: if not None convert the loaded image to this data type.
      reader: register reader to load image file and metadata, if None, will use the default readers.
          If a string of reader name provided, will construct a reader object with the `*args` and `**kwargs`
          parameters, supported reader name: "NibabelReader", "PILReader", "ITKReader", "NumpyReader"
      args: additional parameters for reader if providing a reader name.
      kwargs: additional parameters for reader if providing a reader name.
  
  Raises:
      ValueError: When ``seg_files`` length differs from ``image_files``
docstr_tok: ["Initializes","the","dataset","with","the","image","and","segmentation","filename","lists",".","The","transform","`","transform","`","is","applied","to","the","images","and","`","seg_transform","`","to","the","segmentations",".","Args",":","image_files",":","list","of","image","filenames",".","seg_files",":","if","in","segmentation","task",",","list","of","segmentation","filenames",".","labels",":","if","in","classification","task",",","list","of","classification","labels",".","transform",":","transform","to","apply","to","image","arrays",".","seg_transform",":","transform","to","apply","to","segmentation","arrays",".","label_transform",":","transform","to","apply","to","the","label","data",".","image_only",":","if","True","return","only","the","image","volume",",","otherwise",",","return","image","volume","and","the","metadata",".","transform_with_metadata",":","if","True",",","the","metadata","will","be","passed","to","the","transforms","whenever","possible",".","dtype",":","if","not","None","convert","the","loaded","image","to","this","data","type",".","reader",":","register","reader","to","load","image","file","and","metadata",",","if","None",",","will","use","the","default","readers",".","If","a","string","of","reader","name","provided",",","will","construct","a","reader","object","with","the","`","*","args","`","and","`","*","*","kwargs","`","parameters",",","supported","reader","name",":","``","NibabelReader","''",",","``","PILReader","''",",","``","ITKReader","''",",","``","NumpyReader","''","args",":","additional","parameters","for","reader","if","providing","a","reader","name",".","kwargs",":","additional","parameters","for","reader","if","providing","a","reader","name",".","Raises",":","ValueError",":","When","``","seg_files","``","length","differs","from","``","image_files","``"]
code: def __init__(
      self,
      image_files: Sequence[str],
      seg_files: Sequence[str] | None = None,
      labels: Sequence[float] | None = None,
      transform: Callable | None = None,
      seg_transform: Callable | None = None,
      label_transform: Callable | None = None,
      image_only: bool = True,
      transform_with_metadata: bool = False,
      dtype: DtypeLike = np.float32,
      reader: ImageReader | str | None = None,
      *args,
      **kwargs,
  ) -> None:
      """
      Initializes the dataset with the image and segmentation filename lists. The transform `transform` is applied
      to the images and `seg_transform` to the segmentations.
  
      Args:
          image_files: list of image filenames.
          seg_files: if in segmentation task, list of segmentation filenames.
          labels: if in classification task, list of classification labels.
          transform: transform to apply to image arrays.
          seg_transform: transform to apply to segmentation arrays.
          label_transform: transform to apply to the label data.
          image_only: if True return only the image volume, otherwise, return image volume and the metadata.
          transform_with_metadata: if True, the metadata will be passed to the transforms whenever possible.
          dtype: if not None convert the loaded image to this data type.
          reader: register reader to load image file and metadata, if None, will use the default readers.
              If a string of reader name provided, will construct a reader object with the `*args` and `**kwargs`
              parameters, supported reader name: "NibabelReader", "PILReader", "ITKReader", "NumpyReader"
          args: additional parameters for reader if providing a reader name.
          kwargs: additional parameters for reader if providing a reader name.
  
      Raises:
          ValueError: When ``seg_files`` length differs from ``image_files``
  
      """
  
      if seg_files is not None and len(image_files) != len(seg_files):
          raise ValueError(
              "Must have same the number of segmentation as image files: "
              f"images={len(image_files)}, segmentations={len(seg_files)}."
          )
  
      self.image_files = image_files
      self.seg_files = seg_files
      self.labels = labels
      self.transform = transform
      self.seg_transform = seg_transform
      self.label_transform = label_transform
      if image_only and transform_with_metadata:
          raise ValueError(
              "transform_with_metadata=True requires image_only=False."
          )
      self.image_only = image_only
      self.transform_with_metadata = transform_with_metadata
      self.loader = LoadImage(
          reader, image_only, dtype, *args, **kwargs
      )
      self.set_random_state(seed=get_seed())
      self._seed = 0
  
file_path: MONAI/monai/data/image_dataset.py
imports: from __future__ import annotations
  from collections.abc import Callable, Sequence
  from typing import Any
  import numpy
  from torch.utils.data import Dataset
  from monai.config import DtypeLike
  from monai.data.image_reader import ImageReader
  from monai.transforms import LoadImage, Randomizable, apply_transform
  from monai.utils import MAX_SEED, get_seed
label_desc: Use image node_id 1 to create a new ImageDataset object from inherited base classes: Dataset, Randomizable with example: obj = ImageDataset(image_files, seg_files, labels, transform, seg_transform, label_transform, image_only, transform_with_metadata, dtype, reader)