[vtkusers] 2D API- Image Drawing

Krishna Katamneni krishna.katamneni at gmail.com
Sat Aug 14 03:28:11 EDT 2010


Dear All
Here is the output of drawing vtk logo image using MayaVi and VTK 2D API.

Using MayaVi

[image: MayaVi.PNG]


Using 2DAPI
[image: 2DAPI.PNG]

Here the image is drawn inverted.


When will be the new 2D Image API will be available for use?


On Wed, Aug 4, 2010 at 11:45 PM, Marcus D. Hanwell <
marcus.hanwell at kitware.com> wrote:

> On Wed, Aug 4, 2010 at 2:59 AM, Krishna Katamneni <
> krishna.katamneni at gmail.com> wrote:
>
>> Dear All
>> I have several 2D  images with different dimensions, origins and
>> resolutions.
>> I want to draw them using 2D API (class vtkImageItem) etc and also want
>> the images to be drawn in windows screen coordinates.
>>
>> I'm also confused with parameters for DrawImage method in the 2D API(are
>> these screen coordinates or should be in-terms of image dimensions).
>> When using this method, all my images are upside down.
>>
>
> These are screen coordinates by default, but they can be transformed.
>
>> .
>> For example , my window size is 600x400
>>
>> and have many 2D images(  details of few examples are given below)
>>
>> Image  Details
>>
>>                         Resolution
>> Dimensions                          Origin
>>
>>    1.               0.1 x 0.1 x 1             930   x  700   x
>>    1                -78.3 x 0  x 0
>>    2.               0.2 x 0.2 x 1             1560 x  750   x
>>    1                -78.3 x 0  x 0
>>    3.               0.5 x 0.2 x 1             3100 x  1560 x
>>    1                -100  x 20 x 0
>>    4.               0.1 x 0.2 x 1             360   x  180   x
>>    1               -14.3 x 0  x 0
>>
>> and also would like my image to be to fit to the available window size(I
>> can resize my window dynamically).
>>
>
> I have just added some API to scale the images drawn by a scale factor.
>
>>
>> I think we should be able to create 2D Transform that handles all these
>> cases in one go, but I'm not sure how to achieve it using vtkTransform2D.
>>
>
> The 2D API has a scene, and you can build up a tree, making a vtkImageItem
> the child item of a vtkContextTransform would allow you to them transform
> the child items (translation, scale, rotation), see the TestContextScene
> code for some examples.
>
> There are still issues with test not being transformed correctly, I am
> working on that. Most other stuff should get transformed, and I could likely
> give you a few pointers. I am not sure why your images would be upside down,
> I did not encounter that in my tests.
>
>>
>> Could anybody help me how to handle these situations?
>>
>
> Hopefully that clears some of this up. It would be good to come up with an
> example that could be added to the wiki, and possibly as a new test. I am
> pretty busy right now, but will try to give you further pointers if anything
> is not clear.
>
> Thanks,
>
> Marcus
> --
> Marcus D. Hanwell, Ph.D.
> R&D Engineer, Kitware Inc.
> (518) 881-4937
>



-- 
Best Regards
Krishna Katamaneni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100814/e42e49dd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 105419 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100814/e42e49dd/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 53226 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100814/e42e49dd/attachment-0001.png>


More information about the vtkusers mailing list