Re: Image scaling (sign taken from a Pc Pen)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mike D Sutton (EDais_at_mvps.org)
Date: 12/20/04


Date: Mon, 20 Dec 2004 23:55:15 -0000


> Mike. Since the example works pretty fun, is there any place where I should
> look so I can understand some of the things it does? I.E. what is minlevel,
> maxlevel, LevelsLUT and so on. Is there any web site that explain why does
> this operations are done this way... because I supposed that everything has
> to have a logic. Maybe itīs complicated but it still is logic, isnīt it.
>
> Iīm asking this, because I want to learn and if the opportunity is given,
> enhace this code. If donīt understand deeply what it does, Iīm not going to
> be able to improve it.

I'm still writing the page that describes it all *g*
There's precious little information on graphics programming on VB which I'm trying to rectify through the EDais site, however it all
takes time of which I unfortunately don't have a great deal to spare!
If there's something specific you want more information on then please feel free to ask and we'll do our best to explain. As far as
the levels stuff goes then think of it as magnifying a subset of the data for an image, very useful for defining images with a low
contrast. MinLevel defines the low point and MaxLevel defines the high point of the range and any values in-between are scaled to
the full range of the channel (0-255) Any values that fall outside this range are clipped to the nearest extent (using the
Min()/Max() functions) so as to not overflow since each pixel is represented as a byte with a 0-255 range.
Since this is a 1:1 mapping (i.e. putting the same value in twice as input will return the same value both times) then we can short
circuit the process by calculating all the possible results once and storing them in a LookUp Table or LUT for short - This means
than the main image processing loop need only query the lookup table for the corresponding range adjusted value rather than having
to work it out for each pixel which generally gives a huge performance increase, especially as the complexity of the operation in
the method to produce the LUT is increased.
If you want to do more research then the levels adjustment is an image manipulation technique (often referred to as a filter), and
the API calls used to get/set the data are DIB related, should give you some keywords to hit Goole with :)
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://EDais.mvps.org/



Relevant Pages

  • Re: how to get RGB value from Palette color lookup tables ?
    ... it looks like the transfer syntax for the LUT data is Big Endian (it ... 3.to get RBG value for each pixel from LUT tables it should be done: ... Lookup Table Descriptor ...
    (comp.protocols.dicom)
  • Re: Modality LUT from CR
    ... the stored pixel values, and then the output of that becomes the input ... LUT, then the Window Width/Level calculations are applied directly to ... which describes the Grayscale Standard Display Function. ... modality lut is followed by the voi lut ...
    (comp.protocols.dicom)
  • Re: code optimization help
    ... interpolation lookup table for speed. ... of pixels from the source image that contribute to the corresponding ... contribute to the output pixel. ...
    (comp.soft-sys.matlab)
  • Re: Algorithm for "Windows Center" and "Windows Width"
    ... y represents the output display level. ... For 16 bit pixel values, you have a potential range of 65536 values but you have only a display range of 256 values, so some manipulation must be done. ... As an extra challenge for you, I think you will find that performing this calculation for every pixel everytime the user changes the window settings will make your application run very slowly. ... identity (no rescale values or Modality LUT, ...
    (comp.protocols.dicom)
  • Re: Algorithm for "Windows Center" and "Windows Width"
    ... destBuffer is my image pixel array. ... For 16 bit pixel values, ... I tried to get window width/center as you have suggested. ... identity (no rescale values or Modality LUT, ...
    (comp.protocols.dicom)