Discussion:
[mitk-users] writting a pixel od a mitkImage
Wojciech Lassmann
2017-03-23 18:12:23 UTC
Permalink
Hi I am trying to paint an mitkimage, by mouse clicking and dragging.
(painting both the image and the rendered part would be nice).

To do this I am trying to use ImagePixelWriteAccessor but i dont really
know how to use it.
The example shown in http://docs.mitk.org/nightly/MitkImagePage.html says

itk::Index<2> idx = {{ 12, 34 }};
mitk::ImagePixelWriteAccessor<short,2> writeAccess(image,
image->GetSliceData(4));
writeAccess.SetPixelByIndex(idx, 42);

while the documentatiom says
void SetPixelByIndex
<http://docs.mitk.org/nightly/classmitk_1_1ImagePixelWriteAccessor.html#a7362a491a7724bbdb225abff1337648a>
(const itk::Index <http://docs.mitk.org/nightly/classitk_1_1Index.html><
VDimension > &idx, const TPixel &value)


as I understand, the ImagePixelWriteAccessor first asks for an image and a
slice, and than allows to set a certain pixel of itk::Index
<http://docs.mitk.org/nightly/classitk_1_1Index.html> coordinates with
TPixel value which basically say how grey-ish is it.

1 how can i get the current slice data that is in render window (4 doesn't
seem like good hint)?
2 where do I get the itk::Index
<http://docs.mitk.org/nightly/classitk_1_1Index.html> from (mousePressed->x
and y vary on the size of the screen while image dimension is an int).
3 what is TPixel - cant find any documentation of it. Looks like an int,
but is it?


With regards,
Wojciech Lassmann
Goch, Caspar Jonas
2017-03-24 11:30:23 UTC
Permalink
Hi Wojcieh,

take a look at the project template example interactor:
https://github.com/MITK/MITK-ProjectTemplate/blob/master/Modules/MyAwesomeLib/src/AwesomeImageInteractor.cpp

It allows painting the image in both 2D and 3D and has some explanatory comments.

Best,
Caspar

Von: Wojciech Lassmann [mailto:***@gmail.com]
Gesendet: Donnerstag, 23. MÀrz 2017 19:12
An: mitk-***@lists.sourceforge.net
Betreff: [mitk-users] writting a pixel od a mitkImage

Hi I am trying to paint an mitkimage, by mouse clicking and dragging. (painting both the image and the rendered part would be nice).
To do this I am trying to use ImagePixelWriteAccessor but i dont really know how to use it.
The example shown in http://docs.mitk.org/nightly/MitkImagePage.html says

itk::Index<2> idx = {{ 12, 34 }};
mitk::ImagePixelWriteAccessor<short,2> writeAccess(image, image->GetSliceData(4));
writeAccess.SetPixelByIndex(idx, 42);

while the documentatiom says
void SetPixelByIndex<http://docs.mitk.org/nightly/classmitk_1_1ImagePixelWriteAccessor.html#a7362a491a7724bbdb225abff1337648a> (const itk::Index<http://docs.mitk.org/nightly/classitk_1_1Index.html>< VDimension > &idx, const TPixel &value)

as I understand, the ImagePixelWriteAccessor first asks for an image and a slice, and than allows to set a certain pixel of itk::Index<http://docs.mitk.org/nightly/classitk_1_1Index.html> coordinates with TPixel value which basically say how grey-ish is it.

1 how can i get the current slice data that is in render window (4 doesn't seem like good hint)?
2 where do I get the itk::Index<http://docs.mitk.org/nightly/classitk_1_1Index.html> from (mousePressed->x and y vary on the size of the screen while image dimension is an int).
3 what is TPixel - cant find any documentation of it. Looks like an int, but is it?


With regards,
Wojciech Lassmann

Loading...