No announcement yet.

Scale and Rotate an image in CRF Image viewer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Scale and Rotate an image in CRF Image viewer

    Scale and Rotate an image in CRF Image viewer
    You may need to both rotate and scale and image in the image viewer object for a page to be displayed properly. This is a modified version of the Scale image example.

    Setting up the Macro Library
    The easiest way is to put the code into a macro library at either the Global, Source or Study level. To add a macro library at the Source level:
    1. Go into System Administration / Sources.
    2. Select the libraries tab
    3. Add a row to the library table (Click the little Green +)
    4. Under Description, select Macro Library
    5. Choose a path and save the Source

    Copy and modify the Macro Code
    Once you have the macro library setup, copy the attached macro file SCALERIMG.SAS to the macro directory.

    The image is rotated in a clockwise manner and is defaulted to 90 degrees. You may need to edit the code to rotate the proper amount. If so, open the SCALERIMG.SAS in a text editor and find the following section:
    ** Rotate Image **;
    if imgViewerID then rc=IMGOP(imgViewerID,'ROTATE', 90);
    rc=imgop(imgViewerID,'PASTE'); rc=rc;

    Modfiy the numeric value to indicate how many degrees the image should be rotated. Possible values are 90, 180 or 270.

    Adding the macro calls to DE Screens
    Go into screen design and select the screen where you want the image to be scaled.
    1. Open the OnLoad Method entry
    2. Just after the comment block add the macro call as follows
      ** Call image scale macro **;
    3. Save the screen

    You onLoad method entry should look like this:
    /** onLoad Method **/
    %include objfile;
    _onLoad: method _self_:u:object;
    link createobj;
    ** Add user code here **;
    ** Call image scale and rotate macro **;
    Attached Files
    Last edited by Ronni Rubenstein; 01-05-2007, 01:34 PM.