### Build and Install Wheel Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Commands for creating a wheel file and installing it in a target project. ```bash python setup.py bdist_wheel ``` ```bash pip install \pylibczirw\dist\pylibCZIrw-3.4.0-cp310-cp310-win_amd64.whl ``` -------------------------------- ### Install pylibCZIrw via pip Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Standard installation command from the repository root. ```bash pip install . ``` ```bash pip install --use-feature=in-tree-build . ``` -------------------------------- ### Install Dependencies Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Commands to install project dependencies and the package from the private feed. ```bash python -m pip install --upgrade --requirement requirements.txt ``` ```bash python -m pip install pylibCZIrw --index-url https://pkgs.dev.azure.com/ZEISSgroup/RMS-DEV/_packaging/RMS-PyPI/pypi/simple ``` -------------------------------- ### Install pylibCZIrw and dependencies Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Install the required packages for working with CZI files. ```python ! pip install --upgrade pip ! pip install "pylibCZIrw~=4.1" "cztile>=0.0,<1.0" matplotlib tqdm pooch ``` -------------------------------- ### Editable Installation Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Commands for installing the package in editable mode for development. ```bash pip install . -e ``` -------------------------------- ### Define Tiling Strategy and Get Tile Locations Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Utilize the cztile package to define a tiling strategy for large images. This example demonstrates creating a tiling strategy with specified tile dimensions and overlap, then calculating the tile locations based on a scene's bounding rectangle. ```python import os import pyczi from cztile.fixed_total_area_strategy import AlmostEqualBorderFixedTotalAreaStrategy2D from pyczi.reader import ReaderFileInputTypes # create the filename for the new CZI image file newczi_tile = os.path.join(os.getcwd(), "newczi_tilewise.czi") # create a "tile" by specifying the desired tile dimension and the # minimum required overlap between tiles (depends on the processing) tiler = AlmostEqualBorderFixedTotalAreaStrategy2D( total_tile_width=1600, total_tile_height=1400, min_border_width=128 ) # create CZI instance to read some metadata with pyczi.open_czi(czifile_DAPI_PGC, ReaderFileInputTypes.Curl) as czidoc_r: # get the size of the bounding rectange for the scence tiles = tiler.tile_rectangle(czidoc_r.scenes_bounding_rectangle[0]) # show the created tile locations for tile in tiles: print(tile.roi.x, tile.roi.y, tile.roi.w, tile.roi.h) ``` -------------------------------- ### Install Testing and Quality Packages Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Install additional packages required for code quality analysis and testing. This command installs packages listed in 'requirements_test.txt'. ```bash pip install -r requirements_test.txt ``` -------------------------------- ### Example: Update Document Info and Scaling Source: https://github.com/zeiss/pylibczirw/blob/main/API.md A practical example demonstrating how to update general document information and scaling parameters for a CZI file using the metadata builder. ```APIDOC ### Example: update document info and scaling ```python from pylibCZIrw.czi import edit_czi, ScalingInfoDto, GeneralDocumentInfoDto with edit_czi(file_path) as editor: builder = editor.create_metadata_builder() builder.set_general_document_info( info=GeneralDocumentInfoDto(title="New Title"), user_name="EditorUser", comment="Edited by API", ) builder.set_scaling_info(scale_x=0.25, scale_y=0.25) # leave Z unchanged if builder.can_commit(): builder.commit() # Verify info = editor.read_general_document_info() scaling = editor.read_scaling_info() ``` ``` -------------------------------- ### Install Project Packages Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Install the necessary Python packages for the project from the activated conda environment. This command installs the main package. ```bash pip install . ``` -------------------------------- ### Starting an Edit Session Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Demonstrates how to initiate an edit session using `edit_czi` and obtain a metadata builder. It covers both manual commit and auto-commit scenarios. ```APIDOC ## Starting an Edit Session Edits are made via a metadata builder returned by the editor. The builder accumulates changes and writes them back on `commit()`. ```python with edit_czi(file_path) as editor: builder = editor.create_metadata_builder() # or use auto-commit on success: with editor.edit_session() as builder: ... ``` - `create_metadata_builder()` initializes the builder from the current file state. - `begin_edit()` is an alias for creating a builder. - `edit_session()` yields a builder and auto-commits once on successful exit if `can_commit()` returns True. ``` -------------------------------- ### Install with In-Tree Build Source: https://github.com/zeiss/pylibczirw/blob/main/TROUBLESHOOTING.md Required for specific pip versions to handle in-tree builds correctly. ```bash pip install --use-feature=in-tree-build .[all] ``` -------------------------------- ### Example: Update Display Settings for a Channel Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Illustrates how to modify the display settings for a specific channel within a CZI file, including enabling/disabling, tinting, and setting color and range. ```APIDOC ### Example: update display settings for an existing channel ```python from pylibCZIrw.czi import edit_czi, Rgb8Color, TintingMode, ChannelDisplaySettingsDataClassWithNameAndDescription with edit_czi(file_path) as editor: builder = editor.create_metadata_builder() ds = ChannelDisplaySettingsDataClassWithNameAndDescription( is_enabled=True, tinting_mode=TintingMode.Color, tinting_color=Rgb8Color(r=255, g=0, b=0), black_point=0.05, white_point=0.95, description="Edited by API", ) builder.set_display_settings({0: ds}) # update channel 0 if it exists if builder.can_commit(): builder.commit() ``` ``` -------------------------------- ### Run local linting with MegaLinter Source: https://github.com/zeiss/pylibczirw/blob/main/CONTRIBUTING.md Executes the project's linting suite locally using Docker to match the CI environment. Requires Docker Desktop to be installed. ```bash docker run --rm -t ` -v "${PWD}:/tmp/lint" ` -w /tmp/lint ` -e VALIDATE_ALL_CODEBASE=true ` -e IGNORE_GIT_SUBMODULES=true ` -e PRETTIER_DEFAULT_OPTIONS="--end-of-line=lf" ` -e FILTER_REGEX_EXCLUDE="(^|/)?libs/(pybind11|libCZIrw)/" ` oxsecurity/megalinter:v7 ``` -------------------------------- ### Install Specific Python Version Source: https://github.com/zeiss/pylibczirw/blob/main/TROUBLESHOOTING.md Adjusts the virtual environment to match required Python version dependencies. ```bash conda install python== ``` -------------------------------- ### Write CZI Scenes Source: https://github.com/zeiss/pylibczirw/blob/main/[Doc] High level API.ipynb Write data and tag it with a scene index. The scene index defaults to zero. This example writes data to the same plane but with different scene indices. ```python demo_czi_write = r'D:\pylibCZIrw_demo\demo_write_scenes.czi' with czi.create_czi(demo_czi_write) as new_czi_doc: new_czi_doc.write(data=data_gray8, plane=plane_0, scene=0) #test new_czi_doc.write(data=data_gray8, plane=plane_0, location=(2000, 0), scene=1) ``` -------------------------------- ### Start an Edit Session for CZI Metadata Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Initiates an edit session for a CZI file using a context manager. The builder accumulates changes and can be committed later. Alternatively, `edit_session()` provides auto-commit on successful exit. ```python with edit_czi(file_path) as editor: builder = editor.create_metadata_builder() # or use auto-commit on success: with editor.edit_session() as builder: ... ``` -------------------------------- ### Create and Write to a New CZI File Source: https://github.com/zeiss/pylibczirw/blob/main/[Doc] High level API.ipynb Create a new CZI file and write pixel data to it. The pixel type is determined from the numpy array's shape and data type. This example writes data for two channels with different pixel types. ```python import numpy as np demo_czi_write = r'D:\pylibCZIrw_demo\demo_write_0.czi' with czi.create_czi(demo_czi_write) as new_czi_doc: plane_0 = {'C': 0} plane_1 = {'C': 1} data_gray8 = np.random.randint(255, size=(1024,1024,1),dtype=np.uint8) data_bgr24 = np.random.randint(255, size=(1024,1024,3),dtype=np.uint8) new_czi_doc.write(data=data_gray8, plane=plane_0) new_czi_doc.write(data=data_bgr24, plane=plane_1) ``` -------------------------------- ### Create and Write CZI Files Source: https://context7.com/zeiss/pylibczirw/llms.txt Shows how to initialize a new CZI file and write image data with optional compression settings. ```python from pylibCZIrw import czi as pyczi import numpy as np # Create random image data image_data = np.random.randint(0, 65535, size=(512, 512, 1), dtype=np.uint16) # Create new CZI file with pyczi.create_czi("/path/to/new_image.czi", exist_ok=True) as czidoc: # Write single plane czidoc.write( data=image_data, plane={'C': 0, 'Z': 0, 'T': 0} ) # Create with default compression with pyczi.create_czi( "/path/to/compressed.czi", exist_ok=True, compression_options="zstd0:ExplicitLevel=10" ) as czidoc: czidoc.write(data=image_data, plane={'C': 0}) ``` -------------------------------- ### Creating a CZI File Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Demonstrates how to create a new CZI file using a context manager. It covers default behavior, handling existing files with `exist_ok`, and setting compression options. ```APIDOC ## Creating a CZI File Like with opening, creating a new empty CZI can be done in a context manager using a [path-like-object](https://docs.python.org/3/library/os.html#os.PathLike) (in this case, file_path). `with czi.create_czi(file_path) as czi:` This creates a new czi file at the provided path and **opens it in write mode.** **Note:** Any intermediate-level directories needed to contain the leaf directory are generated if necessary. **Note:** Per default, a [FileExistsError](https://docs.python.org/3/library/exceptions.html#FileExistsError) is raised in case `file_path` already exists. The error can be ignored by calling `with czi.create_czi(file_path, exist_ok = True) as czi:` The compression option is an optional parameter for czi.creat_czi function and can be overwritten with each individual call to the write function. The compression option can be defined by calling `with czi.create_czi(file_path, exist_ok = True, compression_options = zstd0:) as czi:` ``` -------------------------------- ### Import pylibCZIrw Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Import the library to begin using the bindings. ```python from pylibCZIrw import czi ``` ```python from _pylibCZIrw import czi ``` -------------------------------- ### Get Total Bounding Rectangle Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Retrieves the X and Y dimensions for all scenes in a CZI file. Use this to get the overall spatial extent of the image data. ```python with pyczi.open_czi(czifile_scenes, pyczi.ReaderFileInputTypes.Curl) as czidoc: # get the total bounding box for all scenes total_bounding_rectangle = czidoc.total_bounding_rectangle print(total_bounding_rectangle) ``` -------------------------------- ### Configure ZSTD Compression Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Demonstrates setting up ZSTD compression options during CZI file creation or per-write call. ```python # create some array to write to CZI array_big = np.random.randint(low=1, high=50, size=(4096, 4096)).astype(np.uint16) # create the filename for the new CZI image file newczi_uncompressed = os.path.join(os.getcwd(), "newCZI_uncompressed.czi") # create the filename for the new CZI image file newczi_compressed = os.path.join(os.getcwd(), "newCZI_compressed.czi") ``` ```python with pyczi.create_czi(newczi_compressed, exist_ok=True) as czidoc_w: # The CZIWriter class has a compression parameter that allows to define a default compression for each write call. # The write call will the allow you to change the compression for a specific case by setting its compression parameter explicitly as here changing to the zstd0: # writing the image with "zstd0" compression. czidoc_w.write( data=array_big, plane={"C": 0, "T": 0, "Z": 0}, scene=0, compression_options = "zstd0:ExplicitLevel=10", location=(0,0) ) ``` ```python # The compression option could be defined while creating an czi file and could still be overwritten # with each individual call to the write function. with pyczi.create_czi(newczi_uncompressed, exist_ok=True, compression_options = "uncompressed:") as czidoc_w: czidoc_w.write( data=array_big, plane={"C": 0, "T": 0, "Z": 0}, scene=0, location=(0,0) ) ``` ```python size = os.path.getsize(newczi_uncompressed)/1024.0**2 print(f"Size of the uncompressed CZI file : {np.round(size, 2)} MB ") size_comp = os.path.getsize(newczi_compressed)/1024.0**2 print(f"Size of the compressed CZI file 1 : {np.round(size_comp, 2)} MB ") print(f"ZSTD Compression Ratio 1: {np.round(size/size_comp, 2)}") ``` -------------------------------- ### Get Pixel Type Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Discover the pixel type of image channels. ```APIDOC ## Get the pixel type A channel's pixel type can be discovered with using: **`get_channel_pixel_type`** ### `get_channel_pixel_type(channel_index)` #### Description Retrieves the pixel type for a specific channel. #### Parameters ##### Path Parameters - **channel_index** (int) - Required - The index of the channel to query. #### Response Example ```json { "example": "BGR" } ``` Or we can simply get all pixel types using: **`pixel_types`** ### `pixel_types` #### Description Retrieves all pixel types as a dictionary, where the key is the channel index. #### Method GET (Implicit) #### Endpoint N/A (Attribute access) #### Response Example ```json { "example": "{'0': 'BGR', '1': 'Gray'}" } ``` ``` -------------------------------- ### Initialize Missing Submodules Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Run this command if you forgot to link submodules during the initial clone. ```bash git submodule update --init ``` -------------------------------- ### Get Image Dimensions Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Retrieve various dimension properties of CZI image files. ```APIDOC ## Get Image Dimensions There are different properties that allow us to retrieve information about dimensions. The **`total_bounding_box`** gives us all the dimensions of all **orthogonal planes** of the CZI image file. ### `total_bounding_box` #### Description Retrieves all dimensions of all orthogonal planes of the CZI image file. #### Method GET (Implicit) #### Endpoint N/A (Attribute access) #### Response Example ```json { "example": "{'C': 1, 'Z': 1, 'T': 1, 'X': 512, 'Y': 512}" } ``` ## The **`total_bounding_rectangle`** gives us the X and Y dimensions of the CZI, i.e. the (X, Y) of the **`total_bounding_box`**. ### `total_bounding_rectangle` #### Description Retrieves the X and Y dimensions of the CZI image. #### Method GET (Implicit) #### Endpoint N/A (Attribute access) #### Response Example ```json { "example": "[512, 512]" } ``` **Scenes are not orthogonal to the other dimensions.** They are contained within the 2D planes and can be seen simply as tags for certain regions. The **`scene_bounding_rectangle`** give us the bounding rectangle for each scene. ### `scene_bounding_rectangle` #### Description Retrieves the bounding rectangle for each individual scene within the CZI image. #### Method GET (Implicit) #### Endpoint N/A (Attribute access) #### Response Example ```json { "example": "[[0, 0, 512, 512], [0, 0, 256, 256]]" } ``` ``` -------------------------------- ### Clean Git Repository Source: https://github.com/zeiss/pylibczirw/blob/main/TROUBLESHOOTING.md Removes untracked files and directories to resolve interface discovery issues after installation. ```bash git clean -fdx ``` -------------------------------- ### Define CZI file locations Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Define URLs for sample CZI files used in the tutorial. ```python # Define CZI locations czifile_DAPI_PGC = r"https://github.com/zeiss-microscopy/OAD/raw/master/jupyter_notebooks/pylibCZIrw/data/DAPI_PGC.czi" czifile_5dstack = r"https://github.com/zeiss-microscopy/OAD/raw/master/jupyter_notebooks/pylibCZIrw/data/T%3D3_Z%3D5_CH%3D2_X%3D240_Y%3D170.czi" czifile_scenes = r"https://github.com/zeiss-microscopy/OAD/raw/master/jupyter_notebooks/pylibCZIrw/data/w96_A1%2BA2.czi" czifile_timeseries = r"https://github.com/zeiss-microscopy/OAD/blob/master/jupyter_notebooks/pylibCZIrw/data/CellDivision_T%3D16_CH%3D2_ZSTD.czi" ``` -------------------------------- ### Get pixel types Source: https://github.com/zeiss/pylibczirw/blob/main/[Doc] High level API.ipynb Retrieve pixel type information for specific channels or all channels in the CZI file. ```python with czi.open_czi(demo_czi_read) as czi_doc: c0_pixel_type = czi_doc.get_channel_pixel_type(0) print(c0_pixel_type) ``` ```python with czi.open_czi(demo_czi_read) as czi_doc: pixel_type = czi_doc.pixel_types print(pixel_type) ``` -------------------------------- ### Define and Configure _pylibCZIrw_API Library Source: https://github.com/zeiss/pylibczirw/blob/main/_pylibCZIrw/src/api/CMakeLists.txt Sets up the static library target, includes necessary directories, links required dependencies, and enforces C++17 standards. ```cmake add_library( _pylibCZIrw_API STATIC CZIreadAPI.cpp CZIwriteAPI.cpp PImage.cpp CZIreadAPI.h CZIwriteAPI.h PImage.h inc_libCzi.h site.h site.cpp StaticContext.cpp StaticContext.h SubBlockCache.h ReaderOptions.h CZIeditAPI.h CZIeditAPI.cpp) target_include_directories(_pylibCZIrw_API PRIVATE ${libCZI_SOURCE_DIR}) target_link_libraries(_pylibCZIrw_API INTERFACE libCZIStatic JxrDecodeStatic) target_compile_features(_pylibCZIrw_API PRIVATE cxx_std_17) set_property(TARGET _pylibCZIrw_API PROPERTY POSITION_INDEPENDENT_CODE ON) ``` -------------------------------- ### Get All Pixel Types Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Retrieves all pixel types for all channels in a CZI file as a dictionary. The keys are channel indices. ```python with pyczi.open_czi(czifile_scenes, pyczi.ReaderFileInputTypes.Curl) as czidoc: # get all pixel types as a dictionary, where the key is the channel index pixel_type = czidoc.pixel_types print(pixel_type) ``` -------------------------------- ### GET /open_czi Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Opens a CZI file in read-only mode using a file path or stream, with optional subblock caching configurations. ```APIDOC ## GET /open_czi ### Description Opens a CZI file in read-only mode. Supports optional cache configuration to manage memory usage and subblock caching. ### Method GET ### Endpoint czi.open_czi(file_path, cache_options=None) ### Parameters #### Path Parameters - **file_path** (path-like-object) - Required - The path to the CZI file or a stream. #### Request Body - **cache_options** (CacheOptions) - Optional - Configuration object defining cache type, max_memory_usage, and max_sub_block_count. ### Request Example ```python cache_options = CacheOptions( type = CacheType.Standard, max_memory_usage = 500 * 1024**2, max_sub_block_count = 100 ) with czi.open_czi(file_path, cache_options=cache_options) as czi: ... ``` ``` -------------------------------- ### Get Channel Pixel Type Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Retrieves the pixel type for a specific channel using its index. Ensure the channel index is valid for the CZI file. ```python with pyczi.open_czi(czifile_scenes, pyczi.ReaderFileInputTypes.Curl) as czidoc: # get the pixel type for the 1st channel c0_pixel_type = czidoc.get_channel_pixel_type(0) print(c0_pixel_type) ``` -------------------------------- ### Camera and Image Configuration Parameters Source: https://github.com/zeiss/pylibczirw/blob/main/pylibCZIrw/tests/integration/metadata/test_data/test_additional_metadata_metadata.txt Overview of available camera and image configuration properties and their metadata. ```APIDOC ## Camera and Image Configuration ### Description This section lists the available configuration parameters for camera settings and image processing properties. These properties define the operational constraints and metadata for the imaging system. ### Parameters - **CameraBias** (Integer) - Read-only - Default bias value. - **CameraOrientation** (Integer) - Read-only - Current orientation setting. Options: 0:Original, 1:Flip, 2:Reverse, 4:Rotate, 7:FlipReverseRotate, 3:FlipReverse, 6:ReverseRotate, 5:FlipRotate. - **CameraPixelType** (Integer) - Read-only - Pixel format (e.g., Gray16). - **ExposureTime** (Double) - Read-write - Exposure time in seconds. Range: 0.1 to 2000. Increment: 0.1. - **ImageOrientation** (Integer) - Read-write - Image orientation setting. Options: 0:Original, 1:Flip, 2:Reverse, 4:Rotate, 7:FlipReverseRotate, 3:FlipReverse, 6:ReverseRotate, 5:FlipRotate. - **ImagePixelType** (Integer) - Read-only - Pixel format for the image. ``` -------------------------------- ### Get Total Bounding Box Dimensions Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Retrieves all dimensions for orthogonal planes of a CZI image file. Use when you need comprehensive dimensional information. ```python with pyczi.open_czi(czifile_5dstack, pyczi.ReaderFileInputTypes.Curl) as czidoc: # get the image dimensions as an dictionary, where the key identifies the dimension total_bounding_box = czidoc.total_bounding_box print(total_bounding_box) ``` -------------------------------- ### Instantiate CZI Writer Source: https://github.com/zeiss/pylibczirw/blob/main/[Doc] Low level binding.ipynb Creates a new CZI file at the specified path. ```python from _pylibCZIrw import czi_writer ``` ```python CziWriter = czi_writer("demo_names.czi") ``` -------------------------------- ### Get Scene and Total Bounding Boxes Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Retrieves the bounding box information for all scenes and the total image. This is useful for iterating over scenes or understanding image structure. ```python total_bounding_box = get_total_bounding_box() scene_bounding_rectangle = czi.get_scene_bounding_rectangle() total_bounding_rectangle = czi.get_total_bounding_rectangle() print(total_bounding_box) # {'X': (0, 1000), 'Y': (0, 1000)} print(scene_bounding_rectangle) # { 0: (0, 0, 400, 400), 1: (500, 0, 1000, 400), 2: (0, 500, 400, 1000), 3: (500, 500, 1000, 1000)} print(total_bounding_rectangle) # '(0, 0, 1000, 1000)' ``` -------------------------------- ### Instantiate CZI Reader Source: https://github.com/zeiss/pylibczirw/blob/main/[Doc] Low level binding.ipynb Opens a .czi file at the specified path and returns a CZI reader object. ```APIDOC ## Instantiate czi_reader ### Description Opens the .czi at the given path and returns a corresponding czi reader object. ### Method Constructor ### Endpoint N/A (Object Instantiation) ### Parameters #### Path Parameters - **filepath** (string) - Required - The path to the .czi file. ### Request Example ```python from _pylibCZIrw import czi_reader Czi_im = czi_reader("test/well.czi") ``` ### Response #### Success Response (Object) - **czi_reader_object** (object) - A reader object for the CZI file. ``` -------------------------------- ### Get Scene Bounding Rectangles Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Retrieves the bounding rectangle for each individual scene within a CZI file. Useful for understanding the spatial extent of tagged regions. ```python with pyczi.open_czi(czifile_scenes, pyczi.ReaderFileInputTypes.Curl) as czidoc: # get the bounding boxes for each individual scene scenes_bounding_rectangle = czidoc.scenes_bounding_rectangle print(scenes_bounding_rectangle) ``` -------------------------------- ### Prepare Data for Writing Source: https://github.com/zeiss/pylibczirw/blob/main/doc/jupyter_notebooks/pylibCZIrw_4_1_0.ipynb Generate a numpy array to be written into a new CZI file. ```python array = np.random.randint(low=1, high=10, size=(32, 64, 64)).astype(np.uint8) print(array.shape) ``` -------------------------------- ### Clone Repository with Submodules Source: https://github.com/zeiss/pylibczirw/blob/main/README.md Use this command to clone the repository and its submodules. Ensure submodules are included during the initial clone. ```bash git clone --recurse-submodules ``` -------------------------------- ### Create a new CZI file Source: https://github.com/zeiss/pylibczirw/blob/main/API.md Use a context manager to create a new CZI file at the specified path. Intermediate directories are generated if they don't exist. By default, a FileExistsError is raised if the file already exists. ```python with czi.create_czi(file_path) as czi: pass ``` -------------------------------- ### Get Raw XML Metadata from CZI File Source: https://github.com/zeiss/pylibczirw/blob/main/[Doc] Low level binding.ipynb Use this method to retrieve the complete raw XML metadata as a string from a CZI file. Ensure the Czi_im object is properly initialized. ```python Czi_im.GetXmlMetadata() ``` ```xml OptimizeBeforePerformEnabled,ValidateAndAdaptBeforePerformEnabled Before Exp [AF488, AF555] Smart After Exp [AF488, AF555] Smart 0 false true MemoryMappedAndFileStream C:\Users\m1srh\Documents\Zen_Output New true true false JPG false false false true false 90 None C:\Users\m1srh\Pictures New -C;-T;-Z;-S false ErrorAction_Continue false ErrorAction_Continue 1 ComponentUpdateEnabled,StateUpdateEnabled 0.1 Meander FirstYThenX Meander false Center 0,0 true true true true false 1 false 1 false false false AlignedToLocalTileRegion PredefinedSize 0.25 71.68 71.68 false true 2 2 true 1 2.75 true 0 64 64 0 0 true 0` with your desired path and `` with a name for your environment. ```bash conda create -p python ```