Hi Luca,

Ben Dickerhoff and I tried changing the extents to "dim -1" in the header file 
of our image .vti and then running vmtkimagevoipainter. However the output 
painted region was still in a different spatial location than originally 
specified. We were just wondering if you had looked into this problem any 
further and if you had any new insights...

Thanks for all your help. It is greatly appreciated!
Anna
________________________________
From: Luca Antiga [luca.ant...@gmail.com]
Sent: Wednesday, June 06, 2012 2:25 PM
To: Dickerhoff, Benjamin R
Cc: vmtk-users@lists.sourceforge.net
Subject: Re: [vmtk-users] Problem with vmtkimagevoipainter update

Hi Ben,
 yes, you can do that directly and save the file back.
Just change both extents from 0 to dim-1 in each direction. Note that the 
physical location of the image will change (unless you move the origin to 
originalExtent[0] * spacing[0], originalExtent[2] * spacing[1], 
originalExtent[4] * spacing[2]).
Best,

Luca


On 06/giu/2012, at 21:13, "Dickerhoff, Benjamin R" 
<benjamin-dickerh...@uiowa.edu<mailto:benjamin-dickerh...@uiowa.edu>> wrote:

Luca-

    Thanks for the response. When you say to set the origin of the image to 0 0 
0 and the extent from 0 to dim-1 in all directions, do you mean to physically 
change the header in the .vti? Below is the header from one of the image files. 
The origin of the image appears already to be set to "0 0 0".

<VTKFile type="ImageData" version="0.1" byte_order="LittleEndian" 
compressor="vtkZLibDataCompressor">
  <ImageData WholeExtent="203 364 141 396 75 254" Origin="0 0 0" 
Spacing="0.21838390827 0.21838390827 0.21838378906">
    <Piece Extent="203 364 141 396 75 254">
      <PointData Scalars="Scalars_">
        <DataArray type="Float32" Name="Scalars_" format="appended" 
RangeMin="-0.87353515625"       RangeMax="0.87353515625"        offset="0"      
             />
      </PointData>
      <CellData>
      </CellData>
    </Piece>
  </ImageData

Thanks,
Ben
________________________________
From: Luca Antiga [luca.ant...@gmail.com<mailto:luca.ant...@gmail.com>]
Sent: Wednesday, June 06, 2012 11:55 AM
To: Dickerhoff, Benjamin R
Cc: vmtk-users@lists.sourceforge.net<mailto:vmtk-users@lists.sourceforge.net>
Subject: Re: [vmtk-users] Problem with vmtkimagevoipainter update

Dear all,
 I've been off-list for a few days. I'll look into this asap, in the meantime, 
as a test, try setting the origin of the image to 0 0 0 and the extent from 0 
to dim-1 in all directions. Then save the image and execute the vmtk script. I 
suspect it's an extent related issue.
Keep in touch

Luca


On 06/giu/2012, at 16:51, "Dickerhoff, Benjamin R" 
<benjamin-dickerh...@uiowa.edu<mailto:benjamin-dickerh...@uiowa.edu>> wrote:

VMTK Users,

    With regards to the problem that I posted about trouble I was having with 
vmtkimagevoipainter, I have not figured out how to resolve this yet. I have 
figured out that the bounding box in the output has the same dimensions as the 
bounding box chosen as an input, however, its output location in the image set 
is offset towards the corner of the entire input VOI. Additionally, the output 
paint value does correspond to the input value specified using the option 
"-paintvalue".

   Ben Berkowitz helped me simplify the vmtkimagevoipainter script by writing 
the python script at the end of this email. It is intended to take in a vtk 
image file and the bounding coordinates (min and max for x, y, and z) for the 
region we wish to "paint". This script gives the same output as the 
vmtkimagevoipainter script. It seems that the vtkvmtk.vtkvmtkImageBoxPainter() 
script is reading in the input just fine, but can't process where to place the 
region to be painted in the output image. I'm not exactly sure where to go from 
here to help correct this. If anybody has any suggestions, I'd greatly 
appreciate your input.

Thanks for your time,
Ben Dickerhoff

import vtk
import sys
import math
from vmtk import vtkvmtk
from vmtk import vmtkscripts

file = sys.argv[1]

reader = vmtkscripts.vmtkImageReader()
reader.InputFileName = file
reader.Execute()

xmin = float(sys.argv[2])
xmax = float(sys.argv[3])
ymin = float(sys.argv[4])
ymax = float(sys.argv[5])
zmin = float(sys.argv[6])
zmax = float(sys.argv[7])

extents = [xmin, xmax, ymin, ymax, zmin, zmax]

imageBoxPainter = vtkvmtk.vtkvmtkImageBoxPainter()
imageBoxPainter.SetInput(reader.Image)
imageBoxPainter.SetBoxExtent(extents)
imageBoxPainter.SetBoxDefinitionToUseExtent()
imageBoxPainter.SetPaintValue(10)
imageBoxPainter.Update()

writer = vmtkscripts.vmtkImageWriter()
writer.Image = imageBoxPainter.GetOutput()
writer.OutputFileName = file[:-4]+'_painted.vti'
writer.Execute()

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net<mailto:vmtk-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/vmtk-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to