![]() |
IPSDK
4_1_0_2
IPSDK : Image Processing Software Development Kit
|
Application used to demonstrate how to use a disk image. More...
Application used to demonstrate how to use a disk image.
This application demonstrates how to use a disk image during an IPSDK process toolchain. It uses an input TIFF file, copies the image in another disk image, automatically created by IPSDK , and saves the result in a given TIFF file.
The application can be called through a command line as follows:
<application_exe_filename> [--inputImgFilePath <input_image_file_path>] [--outputImgFilePath <output_image_file_path>]
Arguments:
--inputImgFilePath optional; specifies the name of the TIFF file, from
which the input image will be open; if not
specified by the user, the input image is loaded from
file
<DEV_ROOT>/data/Sample/images/Lena_510x509_UInt8.tif
--outputImgFilePath optional; specifies the name of the TIFF file, in
which the output image resulting from the
calculation will be saved;
if not specified by the user, the output image is
saved in file
<TEMPORARY_IPSDK_DIR>/Sample/copyFromDisk.tifThe sequence of operations executed by this application is very similar to other samples.
We start by including all necessary header files:
In the main function body, we start by asking to display all the log messages generated by IPSDK libraries and by our application itself to the application console:
Next, we initialize the IPSDK environment:
Then we declare objects 'inImgFilePath' and 'outImgFilePath'.
Paths are initialized from the command line thanks to the call of the "readCmdArguments" function:
By definition, a disk image is not loaded but only open. Once the IPSDK environment is correctly initialized, we open our input image from the associated TIFF file, by calling the function ipsdk::image::file::openTiffImageFile instead of ipsdk::image::file::loadTiffImageFile.
Please, note that it is also possible to open a RAW image with ipsdk::image::file::openRawImageFile
The image can then be processed as a classical image :
We enclose the function call by a try/catch statement to properly manage the failures.
It is possible to check if the output image is a disk image or not :
It is also possible to modify a single value directly in the file. In the following example, we set the intensity of the very first pixel (x = y = z = c = t = 0) to 255 :
It can be usefull to extract a slice, a channel or a frame from the disk image, or at least a subsample of this slice. It is required for instance for vizualization purpose. In that case, the extracted data is stored as a classical memory image, since it is supposed to contain much less data and therefore fit in memory. The slice coordinate (z, c, t), the size of the new memory image, its offset and the stride (i.e. the step between 2 extracted pixels) must be provided:
Finally, keep in mind that the file is removed when the program exits the image scope, such as the end of the function or terminating the program. This means that the image still need to be saved in a RAW or TIFF file.
To manually remove the disk file, simply set the variable to none: pOutImg = 0.
Finally, the program cleans the IPSDK environment and exitings:
See the full source listing
1.8.14