Loads white and dark correction data from disk

int mira_LoadCorrection(mrkernel *pmr, const char* dirname, const char *scanname);


  • Runtime environment pointer
  • Dirname - a name of a directory containing a scan directory
  • Scanname - a name of a scan directory

Output: Result code (MIRA_OK or error)


For Headwall project type:

Correction information is assumed to be in whiteReference and darkReference scans. To load references, pass the path to a directory containing the whiteReference and darkReference ENVI scans. The third argument is NULL.

Header files must have .hdr extensions. Both spectral cubes can have arbitrary extensions. Reference cubes must be in BIL data layout. Both uint16 and float data types are supported.  


res = mira_LoadCorrection(pmr,"path_to_dir_with_references",NULL);

In this way, both reference files are loaded at the same time.

For Specim project type:

mira_LoadCorrection loads dark and white correction information from dirname directory. The assumption is the a scanname is a name of a directory inside the dirname directory and that it conforms Specim LUMO scanner directory structure. This means that inside scanname directory is a capture sub-directory. Inside the capture sub-dir, the following files are needed:

  • WHITEREF_scanname.hdr
  • WHITEREF_scanname.raw
  • DARKREF_scanname.hdr
  • DARKREF_scanname.raw
  • scanname.hdr

The scanname.hdr defines wavelengths, band cound and pixel count of a scan. Note, that the scanname.raw is not needed when loading correction.

All ENVI cubes are supposed to be in BIL data layout and use uint16 data type.

If mira_LoadCorrection is not called, the assumption is that the input data stream is already reflectance corrected and in float data type. This can be checked using mira_GetInputDataType.