snapbase

Multiple snapshots boards in large images

Description

This generic process replaces the older SnapBase, which has been deprecated and removed because it was unmaintained. This tool has a simpler code, and relies on the BrainVisa infrastructure and viewers. It basically uses one of Brainvisa viewers, iterates it over a set of input data (can be all subjects of a database), and prints snapshots of the views in one or several large image(s).
A viewer process can be used if it either return one or several Anatomist windows (the first one is used then), or if not, if it returns a Qt widget.
The "preset" parameter allows to quickly select a viewer type amongst common ones.
This process requires databasing being enabled during the process run: this means that it will not work correctly when run non-graphically or remotely through soma-workflow. This requirement is needed for the selected viewer to run with only the main input selected (viewers often display several data, and get the other ones by links which require databasing). Moreover some metadata may be print on the snapshots, like subject name, or side, or other metadata only available in BrainVisa database entries for the input data.

Parameters

snapshot: 2D Image ( output )
Output image(s) If an image format us used (like jpeg), and several snapshot pages are needed, the second and additional ones are suffixed with the page number (starting at 0), thus for the output snapshot.jpg, output files will actually be snapshot.jpg, snapshot1.jpg, snapshot2.jpg etc.
If the PDF format is used, then the single output document may contain multiple pages.
preset: Choice ( input )
The "preset" parameter allows to quickly select a viewer type amongst common ones.
It is only here to ease the viewer_type selecton because this one may contain many entries (there are currently more than 130 viewers in Brainvisa toolboxes).
viewer_type: Choice ( input )
Select one of the viewer processes available in BrainVisa. It will be used to display the input data.
input_data type will be dynamically adapted to match the viewer main input parameter.
use_existing_snapshots: Boolean ( input )
input_data: ListOf( Cortical folds graph ) ( input )
The list of main data to be displayed. This is the main entry of the selected viewer. The input_data type is dynamically adapted from the selected viewer.
displayed_attributes: ListOf( String ) ( input )
List of metadata attributes displayed on the snapshots in order to identidy each of them.
Generally we use at least the subject name.
page_size_ratio: Float ( input )
Width / height ratio of large snapshots pages.
max_views_per_page: Integer ( input )
Number of indivisual snapshot images in each large snapshots pages. 0 means no limit (all views in a single page)
indiv_width: Integer ( input )
Width of each snapshot image
indiv_height: Integer ( input )
Height of each snapshot image
referential: Choice ( input )
Referential assigned to each view.
view_config: String ( optional, input )
This optional string main contain a JSON dictionary used to pass settings to Anatomist views before taking snapshots.
This dict is organized as follows:
    {view_type: {side:{"camera": {<cam_options>},
                       "window_config": {<win_config_options>}}}}

view_type corresponds to Anatomist window types identifiers: 3D, Axial, Coronal, Sagittal.
side corresponds to the "side" metadata of the input data, if any, in order to customize camera orientation and settings depending on the brain side.
camera and window_config sub-dicts correspond to parameters passed to Camera and WindowConfig commands of Anatomist commands system.
Ex:
    {
         "3D": {
            "left": {
                "camera": {"zoom": 1.5},
                "window_config": {"light": {"background": [0., 0., 0.7, 1.]}}}
        }   
    }
The config dictionary here is merged to a default one which selects background color for views, and sets a default bounding box, zoom, and camera position and orientation for 3D views, so this parameter can be left empty in most cases.
background_color: ListOf( Float ) ( input )
background color for the output snapshots image(s).
List of 3 float values between 0. and 1. for red, green, blue (RGB).
text_color: ListOf( Float ) ( input )
Text color for printing metadata on snapshots.
List of 3 float values between 0. and 1. for red, green, blue (RGB).
text_offset: ListOf( Integer ) ( input )
(x, y) offset coordinates (int values in pixels) for writing metadata texts on snapshots.
The origin (0, 0) is left, bottom.

Technical information

Toolbox : Data Management

User level : 0

Identifier : snapbase

File name : brainvisa/toolboxes/data management/processes/snapbase.py

Supported file formats :

snapshot :
JPEG image, BMP image, GIF image, JPEG image, MNG image, PBM image, PDF File, PGM image, PNG image, PPM image, TIFF image, TIFF(.tif) image, XBM image, XPM image
input_data :
Graph and data, Graph and data