![]() |
IPSDK
4_1_0_2
IPSDK : Image Processing Software Development Kit
|
Modules demonstrating how to use a disk image with PyIPSDK. More...
Modules demonstrating how to use a disk image with PyIPSDK.
The image size can be very large in some applications. Processing such images will create several images with the same memory size, or even bigger. All of these data may not fit in the memory.
In this case, IPSDK offers the possibility to use disk images instead of memory images. Disk images are not allocated in the computer's RAM but a file is created to store the data on a drive.
It is possible to retrieve or change the path where the disk images are created by IPSDK with the functions PyIPSDK.getAllocatedDiskImagePath() and PyIPSDK.setAllocatedDiskImagePath("/new/path"):
By definition, a disk image is not loaded but only open. Instead of using PyIPSDK.loadTiffImageFile() or PyIPSDK.loadRawImageFile(), which load the data from the file to the memory, the functions PyIPSDK.openTiffImageFile() or PyIPSDK.openRawImageFile() must be called:
The image can then be processed as a classical image :
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:
Because the result is a classical IPSDK memory image, its numpy array is accessible and it can be displayed or processed:
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 meas 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: out = None.
1.8.14