.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/gallery/io/loading_a_directory.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_gallery_io_loading_a_directory.py: ======================================================== Loading a directory of images into RippleImage objects ======================================================== Ripplemapper is capable of loading a directory of images into a list of RippleImage objects. .. GENERATED FROM PYTHON SOURCE LINES 8-15 .. code-block:: Python from ripplemapper.data.example import example_dir from ripplemapper.io import load_dir_to_obj imgs = load_dir_to_obj(example_dir) print(imgs) .. rst-class:: sphx-glr-script-out .. code-block:: none [RippleImage: 1_00052_sample.tif, RippleImage: 1_00205_sample.tif, RippleImage: 1_00375_sample.tif, RippleImage: 1_00443_sample.tif] .. GENERATED FROM PYTHON SOURCE LINES 16-18 We can also select a subset of the images in our path with start, end and skip kwargs. These integer valued parameters work like python slicing [start:end:skip]. .. GENERATED FROM PYTHON SOURCE LINES 19-23 .. code-block:: Python imgs = load_dir_to_obj(example_dir, start=0, end=3, skip=2) print(imgs) .. rst-class:: sphx-glr-script-out .. code-block:: none [RippleImage: 1_00052_sample.tif, RippleImage: 1_00375_sample.tif] .. GENERATED FROM PYTHON SOURCE LINES 24-28 This allows you to chunk up your input into independent processes or to quickly load a subset of your data for testing. Since you can save and load RippleImage objects, you can also save the subset of images. If this is done without the image arrays then you can fit far more images in memory at once .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.008 seconds) .. _sphx_glr_download_generated_gallery_io_loading_a_directory.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: loading_a_directory.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: loading_a_directory.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: loading_a_directory.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_