/* @(#)InvertPseudo.c 1.1 02 Sep 1993 */ /*----------------------------------------------------------------------------- Copyright(C) 1995 , Molecular Structure Group of Biochemestry Dept. at University of California at San Francisco. These coded instructions , statements , and computer programs comprise unpublished proprietary information of the Molecular Structure Group of the Biochemistry Department at University of California at San Francisco , and are protected by Federal copyright law. They may not be disclosed to third parties , copied or duplicated in any form - in whole or in part - without the prior written consent of Molecular Structure Group of Biochemistry Department at University of California at San Francisco. -------------------------------------------------------------------------*/ /* A simple program to reset IWL pseudo color lut table */ #include "IWInclude.h" #include /* fprintf, printf, stderr */ #include /* free, malloc */ int main(int argc, char* argv[]) { int imin, imax, num_values, csiz; int* ctab; int* ired; int* igreen; int* iblue; float scale; int i; if (IWAttach() == IW_ERROR) { (void) fprintf( stderr, "IWL not running or unable to attach to shared memory; quitting\n" ); return 1; } num_values = IWRtLutSize(); IWRtSclMinMax(&imin, &imax); (void) printf(" imin max = %d %d %d\n", imin, imax, num_values); csiz = imin + num_values + IW_NUM_COLORS; ctab = (int*) malloc(3 * sizeof(int) * csiz); if (ctab == 0) { (void) fprintf(stderr, "Unable to allocate space for color table\n"); return 1; } ired = ctab; igreen = ctab + csiz; iblue = ctab + csiz * 2; IWRtLut(ired, igreen, iblue); scale = 255.0f / (imax - imin); for (i = imin; i <= imax; ++i) { int cindex = (i - imin) * scale; ired[i] = cindex; igreen[i] = cindex; iblue[i] = cindex; } IWAlLut(ired, igreen, iblue); free(ctab); return 0; }