.. _sphx_glr_auto_examples_01_data_in: 1. Data In ========== **Background.** Every habitat analysis starts by telling HABIT which images and which tumour mask belong to which patient. **Purpose.** Each page turns files or arrays you already have into a :class:`~habit.contracts.Cohort`; terms are defined on :doc:`/auto_examples/01_data_in/plot_01_directory`. The :doc:`complete analysis ` starts from a :class:`~habit.contracts.Cohort`. Every route on this section ends in one. Each page shows two assemblies: ``Cohort([one_subject])`` and ``Cohort([several_subjects])``. Pass that cohort to ``fit`` / ``fit_predict``. A Python list is not a cohort. Pick the page that matches the files you already have. * **HABIT directory** — ``images///`` and ``masks///``. One series or several. The mask folder name can differ from the series name. :doc:`/auto_examples/01_data_in/plot_01_directory`. * **Loose NIfTI, NRRD, or MetaImage** — one pair or many. You choose the series name and the ROI name. Image and mask grids may differ. :doc:`/auto_examples/01_data_in/plot_04_nifti_files`. * **SimpleITK images already in memory** — :doc:`/auto_examples/01_data_in/plot_02_simpleitk`. * **NumPy arrays or deep-learning tensors** — axis order ``(z, y, x)``, integer mask, ``0`` = background. :doc:`/auto_examples/01_data_in/plot_03_numpy_arrays`. DICOM, and series that still need resampling or bias correction, are not a load route. Preprocess them first (:doc:`/how_to/preprocess`), then use the directory page. The official demo pack is already preprocessed. ``read_image`` / ``read_mask`` accept what SimpleITK reads (``.nii``, ``.nii.gz``, ``.nrrd``, ``.mha``, ``.mhd``). .. raw:: html
.. raw:: html
.. thumbnail-parent-div-open .. raw:: html
.. only:: html .. image:: /auto_examples/01_data_in/images/thumb/sphx_glr_plot_01_directory_thumb.png :alt: :doc:`/auto_examples/01_data_in/plot_01_directory` .. raw:: html
Load from directory
.. raw:: html
.. only:: html .. image:: /auto_examples/01_data_in/images/thumb/sphx_glr_plot_02_simpleitk_thumb.png :alt: :doc:`/auto_examples/01_data_in/plot_02_simpleitk` .. raw:: html
Load from SimpleITK
.. raw:: html
.. only:: html .. image:: /auto_examples/01_data_in/images/thumb/sphx_glr_plot_03_numpy_arrays_thumb.png :alt: :doc:`/auto_examples/01_data_in/plot_03_numpy_arrays` .. raw:: html
Load from NumPy arrays
.. raw:: html
.. only:: html .. image:: /auto_examples/01_data_in/images/thumb/sphx_glr_plot_04_nifti_files_thumb.png :alt: :doc:`/auto_examples/01_data_in/plot_04_nifti_files` .. raw:: html
Load from NIfTI files
.. thumbnail-parent-div-close .. raw:: html
.. toctree:: :hidden: /auto_examples/01_data_in/plot_01_directory /auto_examples/01_data_in/plot_02_simpleitk /auto_examples/01_data_in/plot_03_numpy_arrays /auto_examples/01_data_in/plot_04_nifti_files