PRiSM's Image File : CPA file handling


PRISM software manages image files like FITS files, but it uses its own file system called CPA files. The file CPA data are compressed, without any alteration, meanning that pixel value of 12452 will still be 12452 after compression and decompression. The CPA file manages byte pixel data (0-255), small integer data (-32768 to 32767), floatting point data, as well as complex data (used for FFT), or multiplanes images. The purpose of this page is to provide all the mean to allow any programmer to read and/or write CPA files (version 4D not changed since 2000) by the means of a DLL. This page provides source code, as open source, allowing modification or improvments


All source code here have been made using Delphi 6, but the DLL interface is C/C++ compliant.

The two procedures that allows the operation read and write are the following :


procedure SaveCPA(Name:PChar;HighValue,LowValue:TThreshold;Infos_Image:TInfos_Image;
SizeX,SizeY:Integer;TypeData:Integer;Image:Pointer;NbrePlan:Integer;
var ErrorCode:Integer);

procedure LoadCPA(Name:PChar;var HighValue,LowValue:TThreshold;var Infos_Image:TInfos_Image;
var SizeX,SizeY:Integer;var TypeData:Integer;var Image:Pointer;var NbrePlan:Integer;
var ErrorCode:Integer);

//Error message codes
// -1'Unknown error !'
// 0 'File read successfully'
// 1 'Unable to read the image (missing or corrupted data)'
// 2 'Unknown compressing method !'
// 3 'Corrupted data'
// 4 'Bad Huffman header'
// 5 'Data corrupted (bad Huffman header)'
// 6 'Unable to read the Huffman header'
// 7 'Bad file signature'

This ZIP file contains all the source code and explanations regarding the way to load the CPA file, as well as a sample software for testing the DLL is provided.

This is the DLL : CPAmanagement.dll
This is the test software : ProjectTestCPA.exe

that can be found in dir (once the file unzipped) ...\CPA_testDLL_binaries, the CPA_testDLL(sources) and CPA_DLL(sources) are the directories where the whole source code is provided.


Email Contact : cyril.cavadore###laposte.net , replace ### by the proper character (@) back to my homepage