Difference between revisions of "ViSUS Convert"

From
Jump to: navigation, search
Line 42: Line 42:
  
 
and use the following to create the dataset
 
and use the following to create the dataset
  $CONVERT create temp/test_formats.idx --box "0 511 0 511" --fields "$fields" --bitsperblock 12
+
  $CONVERT create temp/test_formats.idx --box "0 511 0 511" --fields "$fields"
 +
 
 +
=== Tiled dataset ===
 +
Multiple images can be combined (as tiles) to compose a panorama or volume (e.g. stack of image from RMI scans).
 +
 
 +
This can be easily performed specifying the destination ''box'' of each image, as following:
 +
 
 +
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "  0 255    0 255"
 +
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "256 511    0 255"
 +
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "  0 255  256 511"
 +
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "256 511  256 511"
 +
 
 +
=== Conversion from image to IDX ===
 +
 
 +
Conversion from IDX to image formats can be performed as well using the same technique, as following:
 +
 
 +
$CONVERT import temp/test_formats.idx --field scalar --box "  0 255    0 255"  export temp/test_formats_scalar.tga
 +
$CONVERT import temp/test_formats.idx --field scalar --box "256 511    0 255"  export temp/test_formats_scalar.jpg 
 +
$CONVERT import temp/test_formats.idx --field scalar --box "  0 255  256 511"  export temp/test_formats_scalar.tif 
 +
$CONVERT import temp/test_formats.idx --field scalar --box "256 511  256 511"  export temp/test_formats_scalar.bmp
 +
$CONVERT import temp/test_formats.idx --field scalar --box "128 383  128 383"  export temp/test_formats_scalar.png

Revision as of 21:42, 31 July 2017

Introduction

ViSUS convert is the tool that allows to convert data from different file formats (i.e. mainly image formats and raw) to IDX.

The supported formats are the ones supported by FreeImage.

In the following examples we will use the variable $CONVERT as the visus convert executable. You can set this variable using your OS commands like:

export CONVERT=/path/to/visus_executable

or

setenv CONVERT /path/to/visus_executable

The variable $RESOURCES is used instead to indicate a folder that contains the data to convert.

Some useful definitions:

  • a box defines the extent of the domain where the samples are placed for each dimension
  • the dims are the number of samples for each dimension
  • the dtype (i.e. datatype) is defined as a combination of the number type and the number of components (e.g. int8 with 3 components will be int8[3], for single component a simple int8 can be used)

Examples

Simple conversion

For very simple conversions, all you need is:

$CONVERT import $RESOURCES/cat_gray.tga create temp/cat_gray.idx 

Get information

To *get information* about any file (including non-idx), use info

$CONVERT info $RESOURCES/cat_gray.tga
$CONVERT info $RESOURCES/cat_rgb.tga
$CONVERT info temp/cat_gray.idx
$CONVERT info temp/cat_rgb.idx

Create the IDX dataset

To explicitly create the idx volume

You can define a set of fields:

fields="scalar uint8 compressed + vector uint8[3] compressed"

and use the following to create the dataset

$CONVERT create temp/test_formats.idx --box "0 511 0 511" --fields "$fields"

Tiled dataset

Multiple images can be combined (as tiles) to compose a panorama or volume (e.g. stack of image from RMI scans).

This can be easily performed specifying the destination box of each image, as following:

$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "  0 255     0 255" 
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "256 511     0 255"
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "  0 255   256 511"
$CONVERT import $RESOURCES/cat_gray.tga export temp/test_formats.idx --field scalar --box "256 511   256 511"

Conversion from image to IDX

Conversion from IDX to image formats can be performed as well using the same technique, as following:

$CONVERT import temp/test_formats.idx --field scalar --box "  0 255     0 255"  export temp/test_formats_scalar.tga 
$CONVERT import temp/test_formats.idx --field scalar --box "256 511     0 255"  export temp/test_formats_scalar.jpg  
$CONVERT import temp/test_formats.idx --field scalar --box "  0 255   256 511"  export temp/test_formats_scalar.tif  
$CONVERT import temp/test_formats.idx --field scalar --box "256 511   256 511"  export temp/test_formats_scalar.bmp 
$CONVERT import temp/test_formats.idx --field scalar --box "128 383   128 383"  export temp/test_formats_scalar.png