mbs2tiff_drop_shadow.gif


Here are the function calls, their arguments, return codes and provide some notes about how they should be used for the MBS2TIFF library.


Initializing the Library

The calling application must first initialize the library.

Function Call

int acsMBS_Init( char *ParentDir);

Arguments

ParentDir  path to the location of the library (dll) and its supporting files
           and the acs.key file which is read by the library for licensing. 
          

Return Codes

-1          license failure
 0          success



Opening a MEBES Files or Job Deck

After initializing the library, the calling application must then open the MEBES file or Job Deck. (The library can automatically detect whether the file is a job deck or a pattern file.)

Function Call

int acsMBS_OpenFile( const char *filename);

Arguments

Filename  the fully qualified path and file name to the input MEBES file 
          or to the job deck. The library will automatically detect whether the input
          file is a MEBES file or a job deck. If a job deck, the library reads the list
          of files from the job deck and opens each file specified in the job deck.

Return Codes

-1          license failure
 0          file opened successfully
 1          file was not found
 2          invalid file format
 3          exception occurred


Functions for Getting Information About the MEBES Data



Getting the Data Extents

Prior to requesting a data window (also known as the region of interest, ROI) one ought to be sure of the data extents. Requesting a window outside the extents of the data doesn't make any sense. Extents data is in microns. The precision of the data can vary - for example MEBES I supports a grid no finer than 0.5 um. MEBES II is 0.25 um. Mode III can vary from 0.25 to 1.1 with 7 places of precision; but later versions of MEBES support very fine resolutions.

Function Call

int acsMBS_GetExtents(double *llx, double *lly, double *urx, double *ury);

Arguments

llx - the lower left X coordinate of the data extents (um)

lly - the lower left Y coordinate of the data extents

urx - the upper right X coordinate of the data extents

ury - the upper right X coordinate of the data extents

Return Codes

-1          license failure
 0          file is open and extents returned
 1          a file is not currently open so no extents could be returned
           
 3          exception occurred



Getting Number of Levels

A job deck may refer to one or possibly more "levels." This function can be used to determine how many levels are referenced in the job deck.

Function Call

int acsMBS_GetNumOfLevels();

Arguments



Return Codes

-1                license failure
 0                a file is not currently open
 1 or greater     the number of levels.



Getting Level Number

Returns the idx'th level number for the current open job deck. [Get clarification on this function from Josh]

Function Call

int acsMBS_GetLevelNumber(int idx);

Arguments

idx     index number of available levels

Return Codes

-1                license failure
 0                a file is not currently open
 1 or greater     level number at the index specfied



Setting the Window (ROI)

Now that the file is open and the extents of the data are known, a window can be set. The window is referred to as the region of interest as it is this region that will be rasterized (or converted to GDSII).

Function Call

int acsMBS_SetROIWindow (double llx, double lly, double urx, double ury);

Arguments

llx - the lower left X coordinate of the window (um)

lly - the lower left Y coordinate of the window

urx - the upper right X coordinate of the window

ury - the upper right X coordinate of the window

Return Codes

-1          license failure
 0          file is open and desired ROI window is set.
 1          a file is not currently open so no window could be set
           
 3          exception occurred



Getting a Bitmap of the Region of Interest

This command is used after the window has been set. If no window was set using acsMBS_SetROIWindow then the default value of the ROI is equal to the data extents. Also notice that there is no explicit DPI set -- the effective DPI is calculated using the width of bitmap image divided by the width of the ROI. The origin is considered to be at the lower left corner so this information is always preserved whereas data at the upper right corner could be lost if the aspect ratio of the input window and the aspect ratio of the image do not match.

Function Call

int acsMBS_GetROIImageBits 
    (int OutputWidth, 
     int OutputHeight, 
     unsigned char **Image, 
     long *ImageSize
    ) 

Arguments

OutputWidth  - bitmap width in pixels

OutputHeight - bitmap height in pixels

Image        - pointer to the starting point of a block of contiguous memory 
               which contains the raw bitmap.

ImageSize    - size of the raw bitmap image. if the width (row) of the bitmap is not a 
               multiple of 8 pixels, then the row is padded out until it is an integer 
               multiple of 8 in order to calculate the image size.


               Example 1  bitmap = 4096 w x 4096 h
                          1 row of 4096 pixels is  512 bytes; 
                          512 bytes x 4096 rows = 2,097,152 bytes  

               Example 2  bitmap = 1020 w x 1020 h
                          1 row of 1020 pixels requires 128 bytes; 
                          128 x 1020 rows = 130,560 bytes   

Return Codes

-1          license failure
 0          file is open and requested bitmap placed in memory.
 1          a file is not currently open so no window could be set
 2          invalid coordinates - ROI coordinate are outside of data extents          
 3          exception occurred



Releasing the Bitmap Memory

This command is used after the a bitmap has been created in memory and the calling application is "done" with whatever it needed the bitmap for. It should also be used after the acsMBS_GetROIImageToDisk call.

Function Call

int  acsMBS_FreeROIImage () 

Arguments

None 

Return Codes

-1          license failure
 0          successful
 1          no file open
          
 3          exception occurred



Writing a BitMap to File

Some calling applications would prefer to have the bitmap written directly to a file. the DLL supports both TIFF and BMP output to file. TIFF files are compressed using the packbits routine. Both TIFF and BMP are monochrome images. Prior to using the call, one must set the output format.

Function Call

int acsMBS_GetROIImageToDisk 
    (int outputWidth, 
     int outputHeight, 
     const char *filename, 
     long *ImageSize) 
 

Arguments

outputWidth   -       width of the bitmap file in pixels

outputHeight  -       height of the bitmap file in pixels
 
filename      -       output file name (use a fully qualified path name 
                      such as "C:\data\tiff\output01.tif")

ImageSize     -       size of the output file in bytes. Row width is padded so 
                      that it is a multiple of 8.


Return Codes

-1          license failure
 0          successful
 1          no file open
 2          invalid coordinates - outside of image extents         
 3          exception occurred
 4          invalid resolution (possibly negative width or height)
 5          file I/O write error



Setting the Type of Bitmap Written to File

Prior to calling the function that writes a bitmap to file, the programmer should have set the type of bitmap. Currently there are two types: TIFF and Windows BMP. Both types are monochrome images (1 bit per pixel); The TIFF output is compressed using packbits.

Function Call

int acsMBS_SetROIImageFormat (int format);  

Arguments

  0   -    output will be Windows BMP
  1   -    output will be TIFF (packbits compression)   

Return Codes

-1          license failure
 0          successful
 3          exception occurred



Interupting the DLL

At times it may be necessary to interrupt the DLL before it completes. After processing 10,000 polygons the DLL pauses and yields the CPU and checks the value of the stop flag. If the stop flag has been set = 1 then the DLL terminates -- termination is graceful in that any results produced are written correctly to disk(or to memory depending on which call was in action). In the future, we may modify this function to use a timer instead of counting polygons.

Function Call

void acsMBS_SetStopProcess (int stopFlag);   

Arguments

  0   -    DLL continues normally
  1   -    DLL terminates   

Return Codes

 NA



Turn on Logging

At times it may be helpful to have the DLL save a log of its activities -- primarily during debugging. This call turns on a logger.

Function Call

void acsMBS_SetLogGeneration (char *FileName)    

Arguments

  Filename   -    fully qualified filename for the log data.
                  Null if the filename is null then logging is
                  switched off.


Return Codes

 NA





  Price Download Revision History