# How to Highlight the specified area on the slices obtained by VTKImageReslices

**URL:** https://discourse.vtk.org/t/how-to-highlight-the-specified-area-on-the-slices-obtained-by-vtkimagereslices/1209
**Category:** Support
**Created:** [June 25, 2019, 8:07am UTC](https://discourse.vtk.org/t/how-to-highlight-the-specified-area-on-the-slices-obtained-by-vtkimagereslices/1209 "2019-06-25T08:07:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![WtDMaO](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@WtDMaO](https://discourse.vtk.org/u/WtDMaO)
#### Post date: [June 25, 2019, 8:07am UTC](https://discourse.vtk.org/t/how-to-highlight-the-specified-area-on-the-slices-obtained-by-vtkimagereslices/1209/1 "2019-06-25T08:07:01Z")

</div>

Actually, I consider this matter as a problem of coordinate transformation.  
What I want is to highlight the specified area like lesion on the CT.

This is easy to achieve while the CT is normal like this  
[http://vtk.1045678.n5.nabble.com/file/t342766/1P%401%4046%24T\_\_%40HL}%T%UUYSL.png](http://vtk.1045678.n5.nabble.com/file/t342766/1P%401%4046%24T__%40HL%7D%25T%25UUYSL.png)

```
        SetElement(0, 0, _resliceMatrix, 1); 
        SetElement(0, 1, _resliceMatrix, 0); 
        SetElement(0, 2, _resliceMatrix, 0); 

        SetElement(1, 0, _resliceMatrix, 0); 
        SetElement(1, 1, _resliceMatrix, 1); 
        SetElement(1, 2, _resliceMatrix, 0); 

        SetElement(2, 0, _resliceMatrix, 0); 
        SetElement(2, 1, _resliceMatrix, 0); 
        SetElement(2, 2, _resliceMatrix, 1); 

        SetElement(3, 0, _resliceMatrix, 44); 
        SetElement(3, 1, _resliceMatrix, 143); 
        SetElement(3, 2, _resliceMatrix, 81); 
        SetElement(3, 3, _resliceMatrix, 1); 

```

However I have to use vtkimagereslice to get some special effect like this,  
so I changed the direction of three axis like below  
\<[http://vtk.1045678.n5.nabble.com/file/t342766/Z%28%7E%5DJ%5D%5DH%24\_Y69HQZ9XAY7%5B2.png](http://vtk.1045678.n5.nabble.com/file/t342766/Z%28~%5DJ%5D%5DH%24_Y69HQZ9XAY7%5B2.png)\>

```
        SetElement(0, 0, _resliceMatrix, 16 / Math.Sqrt(378)); 
        SetElement(0, 1, _resliceMatrix, -11 / Math.Sqrt(378)); 
        SetElement(0, 2, _resliceMatrix, -1 / Math.Sqrt(378)); 

        SetElement(1, 0, _resliceMatrix, -2 / Math.Sqrt(14)); 
        SetElement(1, 1, _resliceMatrix, -3 / Math.Sqrt(14)); 
        SetElement(1, 2, _resliceMatrix, 1 / Math.Sqrt(14)); 

        SetElement(2, 0, _resliceMatrix, 1 / Math.Sqrt(27)); 
        SetElement(2, 1, _resliceMatrix, 1 / Math.Sqrt(27)); 
        SetElement(2, 2, _resliceMatrix, 5 / Math.Sqrt(27)); 

        SetElement(3, 0, _resliceMatrix, 44); 
        SetElement(3, 1, _resliceMatrix, 143); 
        SetElement(3, 2, _resliceMatrix, 81); 
        SetElement(3, 3, _resliceMatrix, 1); 

```

So the key problem is that I have known the position (x,y,z) of lesion, How  
can I get the lesion position in the picture after the rotation and  
translation by VTKImageReslice. I have tried to use the \_resliceMatrix but  
it doesn’t work, the new point(x’,y’,z’) I got is wrong .

```
        vtkImageData resliced = imageReslice.GetOutput(); 
        _Image = ImageData2Bitmap(resliced, 1600, -400); 

```

And I’ve got another situation, after the code above, I found the position I  
need acctually is the Drawing Coordinate System.  
\<[http://vtk.1045678.n5.nabble.com/file/t342766/Z%28%7E%5DJ%5D%5DH%24\_Y69HQZ9XAY7%5B2.png](http://vtk.1045678.n5.nabble.com/file/t342766/Z%28~%5DJ%5D%5DH%24_Y69HQZ9XAY7%5B2.png)\>

If I highlight the position (0,0), it will highlight the left corner of the  
image.

This has bothered me for one week, any help will be appreciated ！！
