Hi Giuseppe,

 in your case you should first create a larger image that fits all three images 
you have to merge, which will act as a "canvas", and then to resample as I 
described originally, using the canvas as the reference image.

For instance (note that I just made up the spacing, use the real spacing from 
your data):

vmtkimagereslice -ifile CCA.vti -origin 350 2 9 -spacing 1.0 1.0 1.0 -extent 0 
99 0 99 0 99 -ofile canvas.vti

In the script above, the 99's should be replaced with (in pseudo-code, you'll 
have to compute this quantity and replace the 99 with the result - I couldn't 
do it because I didn't know the spacing)

extent[1] = max( CCAOrigin[0]+spacing[0]*CCADimension[0], 
ICAOrigin[0]+spacing[0]*ICADimension[0], 
ECAOrigin[0]+spacing[0]*ECADimension[0])

extent[3] = max( CCAOrigin[1]+spacing[1]*CCADimension[1], 
ICAOrigin[1]+spacing[1]*ICADimension[1], 
ECAOrigin[1]+spacing[1]*ECADimension[1])

extent[5] = max( CCAOrigin[2]+spacing[2]*CCADimension[2], 
ICAOrigin[2]+spacing[2]*ICADimension[2], 
ECAOrigin[2]+spacing[2]*ECADimension[2])


At this point your canvas should be large enough to fit all three images: use 
it as -rfile canvas.vti to resample CCA.vti, ICA.vti and ECA.vti, and then 
merge.

Hope this helps

Luca


On Nov 7, 2011, at 5:48 PM, Giuseppe Isu wrote:

> Hi Luca,
> 
> thanks for your prompt response.
> 
> I guess I understood what you suggested. I also tried to run the code you 
> attached, but without results. 
> Now I have three images (name them CCA.vti, ICA.vti, ECA.vti) yielded by 
> vmtksurfacemodeller. These different images doesn't have the same origin, but 
> have the same spacing. To better explain what is my difficulty in solving 
> this problem, I could say that you can imagine the different images located 
> as follows: 
> 
> CCA.vti has origin [350.79, 2.69, 9.60] and dimension 65x68x198;
> ICA.vti  [358.33, 11.48, 49.40] and dimensions 26x31x40;
> ECA.vti [351.97, 6.20 , 49.40] and dimensions 26x21x40.
> 
> When I reslice ICA.vti in CCA.vti, as you told me, I produce a new image with 
> dimensions 65x68x198, which is completely black either I put negative value 
> as background or a positive one. Now I see that two images to be composed 
> together should have the same origin and the same sample spacing. So as an 
> example, if I want to merge CCA.vti and ICA.vti, refering with the dimensions 
> above, both CCA.vti and ICA.vti should have dimensions 26x31x238, shouldn't 
> they? If they should, how can I do it using vmtkimagereslice?
> 
> I thank you in advance again.
> Best Regards 
> 
> 
> 
> 2011/11/3 Luca Antiga <luca.ant...@orobix.com>
> Hi Giuseppe,
>  I think the approach of lofting the three branches separately is the way to 
> go.
> 
> When you use vmtkimagecompose you have to make sure of a few things:
> 
> - that the images you are trying to merge have the same number of pixels in 
> each direction and have the same spacing and origin;
> - that you choose the right compose operation: if the images produced by 
> vmtksurfacemodeller are positive inside the vessel, you should choose 
> -operation max, otherwise -operation min.
> 
> If your images have different number of pixels, origins or spacings, you need 
> to resample one over the other before composing. Say you have image2.mha that 
> you want to merge with image1.mha: run
> vmtkimagereslice -ifile image2.mha -rfile image1.mha -ofile image2on1.mha 
> -background 4.0
> At this point image2on1.mha will be image2 resampled on image1's grid, so you 
> can proceed and compose them. Note that the -background has to be set to a 
> negative value if the vessel interior is positive, and positive if the vessel 
> is negative.
> 
> I hope you have enough information to get started.
> 
> Best regards
> 
> Luca
> 
> 
> On Nov 3, 2011, at 4:13 PM, Giuseppe Isu wrote:
> 
> > Hello everybody,
> >
> > I'm dealing with a reconstruction of two stenosesd carotid bifurcations by  
> > DICOM sets of MRI black-blood images.
> > Since I couldn't perform level set segmentation by vmtk due to the 
> > black-blood images, and since negating images entails a loss of information 
> > in the stenosed area (stenosis became hard to disitinguish), I used a 
> > commercial software for segmentation and I obtained a set of polylines.
> >
> > Doing this, the first problem encountered has been lofting the surfaces 
> > over the curves: at the bifurcation site lofting becomes impractical and I 
> > could only loft CCA, ICA and ECA surfaces separately. I thought of using 
> > vmtk to solve this problem and in particular I thought of 
> > vmtksurfacemodeller script.
> > My idea was to input this script the entire *.stl geometry (of CCA, ICA and 
> > ECA surfaces unlinked to each other), yielding a vti image and then 
> > performing marching cubes.
> > This procedure succeeded for one of my carotids, and I tried to perform the 
> > same sequence of comands also for a second carotid geometry that I need to 
> > reconstruct. This time whithout any result: the vti image returned by 
> > vmtksurfacemodeller is quitely noisy (I figure out it's due to 
> > miscalculation of distance function near the bifurcation site).
> > Nevertheless I didn't give up! I thought of a second possible solution that 
> > implies the use of vmtksurfacemodeller but in a different way.
> > I extracted separately vti images of respectively CCA, ICA and ECA branches 
> > and I thought to compose the image with the script vmtkimagecompose but 
> > without results.
> > Now I have three different images which I want to merge but I can't do this 
> > and I can't understand if it is a possible task or, otherwise, I ought to 
> > change approach.
> >
> > Could you help me?
> >
> > I thank you in advance
> >
> > --
> > Giuseppe Isu
> > ------------------------------------------------------------------------------
> > RSA(R) Conference 2012
> > Save $700 by Nov 18
> > Register now
> > http://p.sf.net/sfu/rsa-sfdev2dev1_______________________________________________
> > vmtk-users mailing list
> > vmtk-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/vmtk-users
> 
> 
> 
> 
> -- 
> Giuseppe

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to