From 8ebfd1aa5da818f76c1b106ad59d343e4069219a Mon Sep 17 00:00:00 2001 From: "K. Gofron" Date: Thu, 30 May 2019 19:54:44 -0400 Subject: [PATCH 1/6] Fixed serious bug. The gain file header was not read properly resulting in ioc crash on read --- perkinElmerApp/src/PerkinElmer.cpp | 64 +++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/perkinElmerApp/src/PerkinElmer.cpp b/perkinElmerApp/src/PerkinElmer.cpp index 60f5fc2..3e61f82 100755 --- a/perkinElmerApp/src/PerkinElmer.cpp +++ b/perkinElmerApp/src/PerkinElmer.cpp @@ -1565,6 +1565,9 @@ asynStatus PerkinElmer::loadGainFile (void) struct stat stat_buffer; static const char *functionName = "loadGainFile"; + WinHeaderType fileHeader; + WinImageHeaderType imageHeader; + asynPrint(pasynUserSelf, ASYN_TRACE_FLOW, "%s:%s: Loading gain file...\n", driverName, functionName); @@ -1582,36 +1585,87 @@ asynStatus PerkinElmer::loadGainFile (void) driverName, functionName, gainPath); return asynError; } + printf("1\n"); if (pGainBuffer_ != NULL) free (pGainBuffer_); - + printf("2\n"); pInputFile = fopen (gainPath, "rb"); + printf("3\n"); if (pInputFile == NULL) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to open gain correction file %s\n", driverName, functionName, gainPath); return asynError; } + + /* + printf("4\n"); fread (&iSizeX, sizeof (int), 1, pInputFile); + printf("5\n"); fread (&iSizeY, sizeof (int), 1, pInputFile); + printf("6\n"); fread (&iByteDepth, sizeof (int), 1, pInputFile); + printf("7\n"); + */ + if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to read file header for gain correction file %s\n", driverName, functionName, gainPath); return asynError; } - pGainBuffer_ = (DWORD *) malloc (iSizeX * iSizeY * iByteDepth); - fread (pGainBuffer_, iByteDepth, iSizeX * iSizeY, pInputFile); + + + + fread(&fileHeader.FileType,sizeof(WORD),1,pInputFile); + fread(&fileHeader.HeaderSize,sizeof(WORD),1,pInputFile); + fread(&fileHeader.HeaderVersion,sizeof(WORD),1,pInputFile); + fread(&fileHeader.FileSize,sizeof(ULONG),1,pInputFile); + fread(&fileHeader.ImageHeaderSize,sizeof(WORD),1,pInputFile); + fread(&fileHeader.ULX,sizeof(WORD),1,pInputFile); + fread(&fileHeader.ULY,sizeof(WORD),1,pInputFile); + fread(&fileHeader.BRX,sizeof(WORD),1,pInputFile); + fread(&fileHeader.BRY,sizeof(WORD),1,pInputFile); + fread(&fileHeader.NrOfFrames,sizeof(WORD),1,pInputFile); + fread(&fileHeader.Correction,sizeof(WORD),1,pInputFile); + fread(&fileHeader.IntegrationTime,sizeof(double),1,pInputFile); + fread(&fileHeader.TypeOfNumbers,sizeof(WORD),1,pInputFile); + + // We were having problems because the file_header structure was not packed. + // That is why these debug printf statements were added + + printf("FileType=%x\n", fileHeader.FileType); + printf("HeaderSize=%d\n", fileHeader.HeaderSize); + printf("HeaderVersion=%d\n", fileHeader.HeaderVersion); + printf("FileSize=%d\n", fileHeader.FileSize); + printf("ImageHeaderSize=%d\n", fileHeader.ImageHeaderSize); + printf("ULX=%d, ULY=%d\n", fileHeader.ULX, fileHeader.ULY); + printf("BRX=%d, BRY=%d\n", fileHeader.BRX, fileHeader.BRY); + printf("NrOfFrames=%d\n", fileHeader.NrOfFrames); + printf("Correction=%d\n", fileHeader.Correction); + printf("IntegrationTime=%f\n", fileHeader.IntegrationTime); + printf("TypeOfNumbers=%d\n", fileHeader.TypeOfNumbers); + printf("sizeof(TypeOfNumbers)=%d\n", sizeof(fileHeader.TypeOfNumbers)); + + fread((void*)&imageHeader,fileHeader.ImageHeaderSize,1, pInputFile); + + printf("8\n"); + pGainBuffer_ = (DWORD *) malloc (fileHeader.BRX * fileHeader.BRY * (fileHeader.TypeOfNumbers/8)); + printf("9\n"); + printf("iSizeX=%d, iSizeY=%d, iByteDepth=%d\n",iSizeX, iSizeY, iByteDepth); + + fread (pGainBuffer_, (fileHeader.TypeOfNumbers/8) * fileHeader.BRX * fileHeader.BRY, 1, pInputFile); + + if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to read data for gain correction file %s\n", driverName, functionName, gainPath); return asynError; } - + printf("11\n"); fclose (pInputFile); - + printf("12\n"); status |= setIntegerParam(PE_GainAvailable, 1); callParamCallbacks(); From d2d5e9efb614ada1e0b921013fa7c5667dbe1c4f Mon Sep 17 00:00:00 2001 From: "K. Gofron" Date: Thu, 30 May 2019 22:32:27 -0400 Subject: [PATCH 2/6] cleaned up the gains reading function --- perkinElmerApp/src/PerkinElmer.cpp | 68 +++++++++++++----------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/perkinElmerApp/src/PerkinElmer.cpp b/perkinElmerApp/src/PerkinElmer.cpp index 3e61f82..d5212d2 100755 --- a/perkinElmerApp/src/PerkinElmer.cpp +++ b/perkinElmerApp/src/PerkinElmer.cpp @@ -1560,7 +1560,7 @@ asynStatus PerkinElmer::loadGainFile (void) int status = asynSuccess; char gainPath[256]; char gainFile[256]; - int iSizeX, iSizeY, iByteDepth; + //int iSizeX, iSizeY, iByteDepth; FILE *pInputFile; struct stat stat_buffer; static const char *functionName = "loadGainFile"; @@ -1585,12 +1585,12 @@ asynStatus PerkinElmer::loadGainFile (void) driverName, functionName, gainPath); return asynError; } - printf("1\n"); + if (pGainBuffer_ != NULL) free (pGainBuffer_); - printf("2\n"); + pInputFile = fopen (gainPath, "rb"); - printf("3\n"); + if (pInputFile == NULL) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to open gain correction file %s\n", @@ -1598,15 +1598,20 @@ asynStatus PerkinElmer::loadGainFile (void) return asynError; } - /* - printf("4\n"); - fread (&iSizeX, sizeof (int), 1, pInputFile); - printf("5\n"); - fread (&iSizeY, sizeof (int), 1, pInputFile); - printf("6\n"); - fread (&iByteDepth, sizeof (int), 1, pInputFile); - printf("7\n"); - */ + // Read fileHeader = 68 bytes + fread(&fileHeader.FileType,sizeof(WORD),1,pInputFile); + fread(&fileHeader.HeaderSize,sizeof(WORD),1,pInputFile); + fread(&fileHeader.HeaderVersion,sizeof(WORD),1,pInputFile); + fread(&fileHeader.FileSize,sizeof(ULONG),1,pInputFile); + fread(&fileHeader.ImageHeaderSize,sizeof(WORD),1,pInputFile); + fread(&fileHeader.ULX,sizeof(WORD),1,pInputFile); + fread(&fileHeader.ULY,sizeof(WORD),1,pInputFile); + fread(&fileHeader.BRX,sizeof(WORD),1,pInputFile); + fread(&fileHeader.BRY,sizeof(WORD),1,pInputFile); + fread(&fileHeader.NrOfFrames,sizeof(WORD),1,pInputFile); + fread(&fileHeader.Correction,sizeof(WORD),1,pInputFile); + fread(&fileHeader.IntegrationTime,sizeof(double),1,pInputFile); + fread(&fileHeader.TypeOfNumbers,sizeof(WORD),1,pInputFile); if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, @@ -1615,25 +1620,8 @@ asynStatus PerkinElmer::loadGainFile (void) return asynError; } - - - fread(&fileHeader.FileType,sizeof(WORD),1,pInputFile); - fread(&fileHeader.HeaderSize,sizeof(WORD),1,pInputFile); - fread(&fileHeader.HeaderVersion,sizeof(WORD),1,pInputFile); - fread(&fileHeader.FileSize,sizeof(ULONG),1,pInputFile); - fread(&fileHeader.ImageHeaderSize,sizeof(WORD),1,pInputFile); - fread(&fileHeader.ULX,sizeof(WORD),1,pInputFile); - fread(&fileHeader.ULY,sizeof(WORD),1,pInputFile); - fread(&fileHeader.BRX,sizeof(WORD),1,pInputFile); - fread(&fileHeader.BRY,sizeof(WORD),1,pInputFile); - fread(&fileHeader.NrOfFrames,sizeof(WORD),1,pInputFile); - fread(&fileHeader.Correction,sizeof(WORD),1,pInputFile); - fread(&fileHeader.IntegrationTime,sizeof(double),1,pInputFile); - fread(&fileHeader.TypeOfNumbers,sizeof(WORD),1,pInputFile); - - // We were having problems because the file_header structure was not packed. + // We were having problems because the file_header structure was not read properly. // That is why these debug printf statements were added - printf("FileType=%x\n", fileHeader.FileType); printf("HeaderSize=%d\n", fileHeader.HeaderSize); printf("HeaderVersion=%d\n", fileHeader.HeaderVersion); @@ -1647,25 +1635,27 @@ asynStatus PerkinElmer::loadGainFile (void) printf("TypeOfNumbers=%d\n", fileHeader.TypeOfNumbers); printf("sizeof(TypeOfNumbers)=%d\n", sizeof(fileHeader.TypeOfNumbers)); + // Read Image Header = 32 bytes fread((void*)&imageHeader,fileHeader.ImageHeaderSize,1, pInputFile); + if (ferror (pInputFile)) { + asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, + "%s:%s: Failed to read image header for gain correction file %s\n", + driverName, functionName, gainPath); + return asynError; + } - printf("8\n"); pGainBuffer_ = (DWORD *) malloc (fileHeader.BRX * fileHeader.BRY * (fileHeader.TypeOfNumbers/8)); - printf("9\n"); - printf("iSizeX=%d, iSizeY=%d, iByteDepth=%d\n",iSizeX, iSizeY, iByteDepth); - - fread (pGainBuffer_, (fileHeader.TypeOfNumbers/8) * fileHeader.BRX * fileHeader.BRY, 1, pInputFile); - + // Read gains image + fread (pGainBuffer_, (fileHeader.TypeOfNumbers/8) * fileHeader.BRX * fileHeader.BRY, 1, pInputFile); if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to read data for gain correction file %s\n", driverName, functionName, gainPath); return asynError; } - printf("11\n"); + fclose (pInputFile); - printf("12\n"); status |= setIntegerParam(PE_GainAvailable, 1); callParamCallbacks(); From 06fb71dfdd72db313a6f7d504748a5968377ef6a Mon Sep 17 00:00:00 2001 From: "K. Gofron" Date: Thu, 30 May 2019 22:41:59 -0400 Subject: [PATCH 3/6] comment debuggin print statements for Gain file loading --- perkinElmerApp/src/PerkinElmer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/perkinElmerApp/src/PerkinElmer.cpp b/perkinElmerApp/src/PerkinElmer.cpp index d5212d2..6b36061 100755 --- a/perkinElmerApp/src/PerkinElmer.cpp +++ b/perkinElmerApp/src/PerkinElmer.cpp @@ -1622,6 +1622,7 @@ asynStatus PerkinElmer::loadGainFile (void) // We were having problems because the file_header structure was not read properly. // That is why these debug printf statements were added + /* printf("FileType=%x\n", fileHeader.FileType); printf("HeaderSize=%d\n", fileHeader.HeaderSize); printf("HeaderVersion=%d\n", fileHeader.HeaderVersion); @@ -1634,6 +1635,7 @@ asynStatus PerkinElmer::loadGainFile (void) printf("IntegrationTime=%f\n", fileHeader.IntegrationTime); printf("TypeOfNumbers=%d\n", fileHeader.TypeOfNumbers); printf("sizeof(TypeOfNumbers)=%d\n", sizeof(fileHeader.TypeOfNumbers)); + */ // Read Image Header = 32 bytes fread((void*)&imageHeader,fileHeader.ImageHeaderSize,1, pInputFile); From 7433590c799b7ff68ef7c3eb3421793682097482 Mon Sep 17 00:00:00 2001 From: "K. Gofron" Date: Thu, 30 May 2019 23:01:09 -0400 Subject: [PATCH 4/6] remove references to no longer unused iSizX iSizeY iByteDepth --- perkinElmerApp/src/PerkinElmer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/perkinElmerApp/src/PerkinElmer.cpp b/perkinElmerApp/src/PerkinElmer.cpp index 6b36061..0603aa6 100755 --- a/perkinElmerApp/src/PerkinElmer.cpp +++ b/perkinElmerApp/src/PerkinElmer.cpp @@ -1560,7 +1560,6 @@ asynStatus PerkinElmer::loadGainFile (void) int status = asynSuccess; char gainPath[256]; char gainFile[256]; - //int iSizeX, iSizeY, iByteDepth; FILE *pInputFile; struct stat stat_buffer; static const char *functionName = "loadGainFile"; From 7b127e1b00bff174d300b2ce95b75c606070bab3 Mon Sep 17 00:00:00 2001 From: "K. Gofron" Date: Fri, 31 May 2019 17:47:55 -0400 Subject: [PATCH 5/6] header structure for Gain file defined --- perkinElmerApp/src/PerkinElmer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/perkinElmerApp/src/PerkinElmer.h b/perkinElmerApp/src/PerkinElmer.h index a8e7b15..ab7a109 100755 --- a/perkinElmerApp/src/PerkinElmer.h +++ b/perkinElmerApp/src/PerkinElmer.h @@ -159,6 +159,9 @@ class PerkinElmer : public ADDriver bool acquireSettingsChanged_; bool doSoftwareTriggers_; + WinHeaderType fileHeader_; + WinImageHeaderType imageHeader_; + bool initializeDetector (void); void setBinning(void); void reportSensors(FILE *fp, int details); From bbc467dee26f16eccd7cc5dfce43e3064deefb7c Mon Sep 17 00:00:00 2001 From: "K. Gofron" Date: Fri, 31 May 2019 17:49:39 -0400 Subject: [PATCH 6/6] Gain file loading and saving --- perkinElmerApp/src/PerkinElmer.cpp | 104 ++++++++++++++++------------- 1 file changed, 58 insertions(+), 46 deletions(-) diff --git a/perkinElmerApp/src/PerkinElmer.cpp b/perkinElmerApp/src/PerkinElmer.cpp index 0603aa6..034d968 100755 --- a/perkinElmerApp/src/PerkinElmer.cpp +++ b/perkinElmerApp/src/PerkinElmer.cpp @@ -1488,9 +1488,6 @@ void PerkinElmer::acquireStopTask(void) /** Saves a gain file */ asynStatus PerkinElmer::saveGainFile(void) { - int iSizeX; - int iSizeY; - int iByteDepth; int status = asynSuccess; char gainPath[256]; char gainFile[256]; @@ -1504,8 +1501,6 @@ asynStatus PerkinElmer::saveGainFile(void) status |= getStringParam(PE_CorrectionsDirectory, sizeof(gainPath), gainPath); status |= getStringParam(PE_GainFile, sizeof(gainFile), gainFile); strcat(gainPath, gainFile); - status |= getIntegerParam(NDArraySizeX, &iSizeX); - status |= getIntegerParam(NDArraySizeY, &iSizeY); if (pGainBuffer_ == NULL) return asynError; @@ -1513,6 +1508,7 @@ asynStatus PerkinElmer::saveGainFile(void) "%s:%s:, saving gain file: %s\n", driverName, functionName, gainPath); + pOutputFile = fopen (gainPath, "wb"); if (pOutputFile == NULL) { @@ -1521,11 +1517,22 @@ asynStatus PerkinElmer::saveGainFile(void) driverName, functionName, gainFile); return asynError; } - iByteDepth = sizeof (DWORD); - fwrite ((void *) &iSizeX, sizeof (int), 1, pOutputFile); - fwrite ((void *) &iSizeY, sizeof (int), 1, pOutputFile); - fwrite ((void *) &iByteDepth, sizeof (int), 1, pOutputFile); + // Write fileHeader = 68 bytes + fwrite((void *) &fileHeader_.FileType,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.HeaderSize,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.HeaderVersion,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.FileSize,sizeof(ULONG),1,pOutputFile); + fwrite((void *) &fileHeader_.ImageHeaderSize,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.ULX,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.ULY,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.BRX,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.BRY,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.NrOfFrames,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.Correction,sizeof(WORD),1,pOutputFile); + fwrite((void *) &fileHeader_.IntegrationTime,sizeof(double),1,pOutputFile); + fwrite((void *) &fileHeader_.TypeOfNumbers,sizeof(WORD),1,pOutputFile); + if (ferror (pOutputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to write file header for file %s\n", @@ -1534,12 +1541,21 @@ asynStatus PerkinElmer::saveGainFile(void) return asynError; } - fwrite (pGainBuffer_, iByteDepth, iSizeX*iSizeY, pOutputFile); + // Write Image Header = 32 bytes + fwrite((void*)&imageHeader_,fileHeader_.ImageHeaderSize,1, pOutputFile); if (ferror (pOutputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, - "%s:%s: Failed to write data for file %s\n", - driverName, functionName, gainFile); - fclose (pOutputFile); + "%s:%s: Failed to read image header for gain correction file %s\n", + driverName, functionName, gainPath); + return asynError; + } + + // Write gain image + fwrite (pGainBuffer_, (fileHeader_.TypeOfNumbers/8) * fileHeader_.BRX * fileHeader_.BRY, 1, pOutputFile); + if (ferror (pOutputFile)) { + asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, + "%s:%s: Failed to read data for gain correction file %s\n", + driverName, functionName, gainPath); return asynError; } @@ -1551,7 +1567,6 @@ asynStatus PerkinElmer::saveGainFile(void) return asynSuccess; } - //_____________________________________________________________________________________________ /** Loads a gain file */ @@ -1564,9 +1579,6 @@ asynStatus PerkinElmer::loadGainFile (void) struct stat stat_buffer; static const char *functionName = "loadGainFile"; - WinHeaderType fileHeader; - WinImageHeaderType imageHeader; - asynPrint(pasynUserSelf, ASYN_TRACE_FLOW, "%s:%s: Loading gain file...\n", driverName, functionName); @@ -1598,19 +1610,19 @@ asynStatus PerkinElmer::loadGainFile (void) } // Read fileHeader = 68 bytes - fread(&fileHeader.FileType,sizeof(WORD),1,pInputFile); - fread(&fileHeader.HeaderSize,sizeof(WORD),1,pInputFile); - fread(&fileHeader.HeaderVersion,sizeof(WORD),1,pInputFile); - fread(&fileHeader.FileSize,sizeof(ULONG),1,pInputFile); - fread(&fileHeader.ImageHeaderSize,sizeof(WORD),1,pInputFile); - fread(&fileHeader.ULX,sizeof(WORD),1,pInputFile); - fread(&fileHeader.ULY,sizeof(WORD),1,pInputFile); - fread(&fileHeader.BRX,sizeof(WORD),1,pInputFile); - fread(&fileHeader.BRY,sizeof(WORD),1,pInputFile); - fread(&fileHeader.NrOfFrames,sizeof(WORD),1,pInputFile); - fread(&fileHeader.Correction,sizeof(WORD),1,pInputFile); - fread(&fileHeader.IntegrationTime,sizeof(double),1,pInputFile); - fread(&fileHeader.TypeOfNumbers,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.FileType,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.HeaderSize,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.HeaderVersion,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.FileSize,sizeof(ULONG),1,pInputFile); + fread(&fileHeader_.ImageHeaderSize,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.ULX,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.ULY,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.BRX,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.BRY,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.NrOfFrames,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.Correction,sizeof(WORD),1,pInputFile); + fread(&fileHeader_.IntegrationTime,sizeof(double),1,pInputFile); + fread(&fileHeader_.TypeOfNumbers,sizeof(WORD),1,pInputFile); if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, @@ -1622,22 +1634,22 @@ asynStatus PerkinElmer::loadGainFile (void) // We were having problems because the file_header structure was not read properly. // That is why these debug printf statements were added /* - printf("FileType=%x\n", fileHeader.FileType); - printf("HeaderSize=%d\n", fileHeader.HeaderSize); - printf("HeaderVersion=%d\n", fileHeader.HeaderVersion); - printf("FileSize=%d\n", fileHeader.FileSize); - printf("ImageHeaderSize=%d\n", fileHeader.ImageHeaderSize); - printf("ULX=%d, ULY=%d\n", fileHeader.ULX, fileHeader.ULY); - printf("BRX=%d, BRY=%d\n", fileHeader.BRX, fileHeader.BRY); - printf("NrOfFrames=%d\n", fileHeader.NrOfFrames); - printf("Correction=%d\n", fileHeader.Correction); - printf("IntegrationTime=%f\n", fileHeader.IntegrationTime); - printf("TypeOfNumbers=%d\n", fileHeader.TypeOfNumbers); + printf("FileType=%x\n", fileHeader_.FileType); + printf("HeaderSize=%d\n", fileHeader_.HeaderSize); + printf("HeaderVersion=%d\n", fileHeader_.HeaderVersion); + printf("FileSize=%d\n", fileHeader_.FileSize); + printf("ImageHeaderSize=%d\n", fileHeader_.ImageHeaderSize); + printf("ULX=%d, ULY=%d\n", fileHeader_.ULX, fileHeader.ULY); + printf("BRX=%d, BRY=%d\n", fileHeader_.BRX, fileHeader.BRY); + printf("NrOfFrames=%d\n", fileHeader_.NrOfFrames); + printf("Correction=%d\n", fileHeader_.Correction); + printf("IntegrationTime=%f\n", fileHeader_.IntegrationTime); + printf("TypeOfNumbers=%d\n", fileHeader_.TypeOfNumbers); printf("sizeof(TypeOfNumbers)=%d\n", sizeof(fileHeader.TypeOfNumbers)); */ // Read Image Header = 32 bytes - fread((void*)&imageHeader,fileHeader.ImageHeaderSize,1, pInputFile); + fread((void*)&imageHeader_,fileHeader_.ImageHeaderSize,1, pInputFile); if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to read image header for gain correction file %s\n", @@ -1645,10 +1657,10 @@ asynStatus PerkinElmer::loadGainFile (void) return asynError; } - pGainBuffer_ = (DWORD *) malloc (fileHeader.BRX * fileHeader.BRY * (fileHeader.TypeOfNumbers/8)); + pGainBuffer_ = (DWORD *) malloc (fileHeader_.BRX * fileHeader_.BRY * (fileHeader_.TypeOfNumbers/8)); - // Read gains image - fread (pGainBuffer_, (fileHeader.TypeOfNumbers/8) * fileHeader.BRX * fileHeader.BRY, 1, pInputFile); + // Read gain image + fread (pGainBuffer_, (fileHeader_.TypeOfNumbers/8) * fileHeader_.BRX * fileHeader_.BRY, 1, pInputFile); if (ferror (pInputFile)) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: Failed to read data for gain correction file %s\n", @@ -1664,8 +1676,8 @@ asynStatus PerkinElmer::loadGainFile (void) "%s:%s:, Gain file %s loaded\n", driverName, functionName, gainPath); return asynSuccess; - } + //_____________________________________________________________________________________________ /** Loads a pixel correction file */