{ "cells": [ { "cell_type": "markdown", "id": "71c86ad9-8a0e-41db-90ab-138f9a00790c", "metadata": {}, "source": [ "# Microstructure Maps -- The CellData Group" ] }, { "cell_type": "markdown", "id": "2be8f9e8-a431-4454-b998-429bd42619ee", "metadata": {}, "source": [ "The main focus of the *Pymicro* package is to provide tools to study the *microstructure-properties* relationship for polycrystalline materials. This work naturally involves working from a description of the microstructure of the studied material samples. These descriptions are generally microstructural images, that can be:\n", "\n", "* outputs of real imaging experiments (DCT, CT, EBSD ...)\n", "* digitally generated microstructure images (Voronoi tesselations, outputs from softwares like Neper, DREAM3D ...)\n", "* outputs of numerical simulations techniques that provide images (such as FFT-based solvers)\n", "\n", "They can be bi-dimensional or tri-dimensional, and usually are maps of the material phases or crystal orientation. This tutorial will review how to store, load and process microstructure images of a material with *Pymicro* and the `Microstructure` class." ] }, { "cell_type": "markdown", "id": "cc4a851f-8d89-4445-a8ed-c13b1d8f6f11", "metadata": {}, "source": [ "The *data model* of [the Microstructure class](./Microstructure_class.ipynb) includes a specific *Group* to store microstructure images, the `CellData` group. " ] }, { "cell_type": "markdown", "id": "c9c8bb16-3bbb-440f-81fd-0c00cd8f49f8", "metadata": {}, "source": [ "## The CellData Group" ] }, { "cell_type": "markdown", "id": "7c8b0dd4-b86f-4f2a-aa33-0647041c7c2e", "metadata": {}, "source": [ "The `CellData` group is an *Image Group* (see [dedicated tutorial](./Image_data.ipynb)), *i.e.* a group designed to store several images of the same dimension. The `CellData` group aim is to store on the same grid images of the studied microstructure from various modalities (for instance, EBSD and SEM images), to allow for simultaneous visualization and cross processing of these data. \n", "\n", "Note that you can directly benefit from 3D visualization of the `CellData` group content by using the Paraview software: an XDMF file for your dataset is automatically generated if you close your microstructure, that you can directly open it with the Paraview software. Alternatively, you can use the `pause_for_visualization` method to do it from your interactive Python interpreter. More details on these functionalities, please refer to this [tutorial](./Get_Datasets_Information.ipynb).\n", "\n", "One of Pymicro's example datasets will be used to illustrate the `CellData` content, let's start by opening it with the `Microstructure` class and display the content of this group:" ] }, { "cell_type": "code", "execution_count": null, "id": "7918b52d-35e3-4315-9870-f4b22cac37dd", "metadata": {}, "outputs": [], "source": [ "import os \n", "from pymicro import get_examples_data_dir # import file directory path\n", "PYMICRO_EXAMPLES_DATA_DIR=get_examples_data_dir() # get file directory path\n", "# import Microstructure class\n", "from pymicro.crystal.microstructure import Microstructure \n", "micro = Microstructure(filename=os.path.join(PYMICRO_EXAMPLES_DATA_DIR,'t5_dct_slice_data.h5'))\n", "\n", "# display CellData group content\n", "micro.print_node_info('CellData')\n", "micro.print_group_content('CellData', short=True)" ] }, { "cell_type": "markdown", "id": "808dfbc8-57c3-4e27-8d50-3c53611701c4", "metadata": {}, "source": [ "Let us now open the dataset and display the content of the group, using the `Microstructure` class:" ] }, { "cell_type": "markdown", "id": "98ae02b6-3e90-4ac6-8e83-c452a31624f0", "metadata": {}, "source": [ "This dataset `CellData` group contains a 3D image of $654x654x1$ voxels, with a resolution of $0.0014$ mm, that has 3 fields: `grain_map`, `mask` and`phase_map`. The microstructure image is actually a 3D image. It is stored as a 3D image as the dataset has been created by extracting a slice of a 3D microstructure dataset. \n", "\n", "These three fields are part of the standard *data model* of the `Microstructure` datasets:\n", "\n", "* `mask`: a field describing the geometry of the sample. It has a 1 value inside the sample, and a 0 value outside the sample (typically, segmented X-ray Contrast Tomography outputs can be used as Microstructure mask). \n", "* `phase_map`: a field indicating for each pixel/voxel the ID of the phase in which it is located. In areas of the Image that are not part of the material sample, the *grain_map* field takes a zero or negative value.\n", "* `grain_map`: a field indicating for each pixel/voxel the ID of the grain in which it is located. In areas of the Image that are not part of the material sample, the *grain_map* field takes a zero or negative value.\n", "\n", "The `phase_map` is empty here. The microstructure only has 1 phase, so this field is not usefull for this dataset." ] }, { "cell_type": "markdown", "id": "5509ce26-5e03-4459-aaef-94df238d5680", "metadata": {}, "source": [ "