Skip to content

Environment setup

Tom Svilans edited this page Nov 2, 2020 · 2 revisions

Using environment variables

Setting environment variables

Setting environment variables requires elevated privileges.

  1. Right-click on My Computer or This PC and select Properties.
  2. Click on Advanced system settings. This will prompt you for your login and password.
  3. In the System Properties dialog, click on Environment Variables... at the bottom right.
  4. In the bottom half of the Environment Variables dialog, in the System variables section, click on New....
  5. In Variable name, type in the name of the environment variable you wish to create (i.e. DEEPSIGHT_DIR).
  6. In Variable value, copy the full path to the Deep Sight base folder (i.e. Q:\CITA\PROJECTS\BEHAVING_ARCHITECTURES\2020-DeepSight).
  7. Click Ok and close all dialogs.
  8. If you have any console windows open, close these and re-open them.

Getting environment variables

Environment variables can be used to point to particular local directories for each user to prevent hard-coded paths in the examples and test scripts.

In Python, getting the value of an environment variable is straightforward. Deep Sight uses an environment variable called DEEPSIGHT_DIR to locate the example datasets. This is the base directory of datasets. Subsequently, all paths to specific datasets are relative to this directory:

import os
deepsight_directory = os.getenv('DEEPSIGHT_DIR')
if deepsight_directory == None: # If there is no environment variable defined...
    deepsight_directory = "C:/" # Set it to some default directory...
    raise # ... or throw an exception, requiring the user to have this environment variable set

filepath = os.path.join(deepsight_directory, "relative/path/to/a/dataset.tif")

import deepsight # Import the Deep Sight library and load a grid
grid = deepsight.Grid.read(filepath)
...

Organizing example datasets

All example datasets must be organized in a clear and consistent manner. Within the Deep Sight base directory, there is a 01_DataSets directory. Within this directory, there are three directories, corresponding to each project domain - 3DPrint-Cellulose, Fungar, Wood. These directories contain specific datasets for each domain.

Each dataset should be in its own folder, named after the dataset (i.e. BranchScan01).

Each dataset folder must contain the data in the appropriate format:

  • A multi-page TIFF file, named after the dataset (i.e. BranchScan01.tif).
  • An OpenVDB file, named after the dataset (i.e. BranchScan01.vdb).
  • A folder with individual TIFFs, called 'frames'. The individual TIFFs should be named after the corresponding dataset, followed by an underscore and an index, padded to 4 places. For example, if the dataset is called BranchScan01, then the 4th individual TIFF will be named BranchScan01_0004.tif. The individual TIFFs would reside in the folder %DEEPSIGHT_DIR%/01_DataSets/Wood/BranchScan01/frames where %DEEPSIGHT_DIR% is the aforementioned Deep Sight base directory defined by an environment variable.
  • An optional folder, called meta. This is for any collateral data, notes, photos, etc. that are tied to the dataset but do not form part of the dataset itself.