.. meta:: :description: Extensions Slice Analysis Measurements Slice Analysis Measurements =========================== This section explains how to create and edit Slice Analysis Measurements. Usage ----- A slice analysis measurement is a statistic computed on each slice of a dataset or of a ROI in the selected view orientation. .. _filesLocationSliceAnalysisMeasurementExtension: Files location -------------- To be recognized by the application, slice analysis measurements should be located in one of these folders: - %LocalAppData%/ORS/Dragonfly(*version*)/pythonUserExtensions/PythonPluginExtensions/SliceAnalysisMeasurement (available for the current user) - %ProgramData%/ORS/Dragonfly(*version*)/pythonAllUsersExtensions/PythonPluginExtensions/SliceAnalysisMeasurement (available for all users) - %ProgramData%/ORS/Dragonfly(*version*)/python/OrsPythonPlugins/OrsSliceAnalysis_6f5200cc55ec11e78ad8c86000a21918/SliceAnalysisMeasurement (distributed with the application) .. note:: All the mandatory files defining a slice analysis measurement should be contained in a folder having the same name as the slice analysis measurement implementation file and the implementation class. For example, a slice analysis measurement named ``ASliceAnalysisMeasurement`` would be constituted of these files: - %LocalAppData%/ORS/Dragonfly(*version*)/pythonUserExtensions/PythonPluginExtensions/SliceAnalysisMeasurement/ASliceAnalysisMeasurement/__init__.py - %LocalAppData%/ORS/Dragonfly(*version*)/pythonUserExtensions/PythonPluginExtensions/SliceAnalysisMeasurement/ASliceAnalysisMeasurement/ASliceAnalysisMeasurement.py See :ref:`extensionFiles` for more information on the purpose of each file. File creation ------------- To create a slice analysis measurement, start the application, start the :mod:`OrsPythonPlugins.OrsSliceAnalysisMeasurementGenerator_5dde388c5a8311e7a65fc86000a21918.OrsSliceAnalysisMeasurementGenerator_5dde388c5a8311e7a65fc86000a21918` (found in *Developer/Generic Slice Analysis Measurement Generator*), fill in the required fields and press the button *Create slice analysis measurement*. File edition ------------ **Design the UI** If a UI is used, design it in the generated file *mainform.ui*. See :ref:`howtodevelopui` for more information. **Develop the code** Open the implementation file (the Python file having the name of the slice analysis measurement) and the mainform file (*mainform.py*) in a text editor. Fill in the required methods. Demos ----- Source code example: #. Download the :download:`compressed file `; #. Extract these files into a :ref:`slice analysis measurement extension folder `; #. Start the application; #. Import a dataset. Make sure it is selected; #. Go to the ROI Tools panel (in the *Segment* tab), in the section *Range*, and use the slider to set the minimal and maximal values of the range. Press the button *Add to New* to create a ROI using this range; #. Right-click on the view and select the menu item *Start Slice Analysis*; #. In the panel *Slice Analysis* that was opened, select the ROI that was created. Check the box next to the measurement *DemoObjCnt*. Click on the measurement name *DemoObjCnt* in order to select that line in the table and make his UI appear at the bottom. Use the *Minimal pixel count* spin box to restrict the objects to be considered to a minimal size. Use the *Consider diagonal* checkbox to specify if pixels touching only on their diagonal will be considered as touching each other; #. Press the button *Compute* to start the computation of the number of objects in each slice of the ROI, in the orientation of the view.