11. Slice Analysis Measurements

This section explains how to create and edit Slice Analysis Measurements.

11.1. Usage

A slice analysis measurement is a statistic computed on each slice of a dataset or of a ROI in the selected view orientation.

11.2. 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 Extension files for more information on the purpose of each file.

11.3. File creation

To create a slice analysis measurement, start the application, start the 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.

11.4. File edition

Design the UI

If a UI is used, design it in the generated file mainform.ui.

See How to develop a User Interface 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.

11.5. Demos

Source code example:

  1. Download the compressed file;
  2. Extract these files into a slice analysis measurement extension folder;
  3. Start the application;
  4. Import a dataset. Make sure it is selected;
  5. 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;
  6. Right-click on the view and select the menu item Start Slice Analysis;
  7. 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;
  8. 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.