[vmtk-users] get cross-sectional image perpendicular to centerline

543 views
Skip to first unread message

Xiaoli Zhang

unread,
Aug 21, 2013, 12:44:32 PM8/21/13
to vmtk-...@lists.sourceforge.net
Hi all,

I am wondering if there is a way in vmtk to get the cross-sectional image (from 3D volumetric grayscale image: vti) following the centerline (.vtp) and alway perpendicular to the centerline.

Thanks,
Xiaoli

Luca Antiga

unread,
Aug 27, 2013, 4:20:44 AM8/27/13
to Xiaoli Zhang, vmtk-...@lists.sourceforge.net
Hi Xiaoli,
yes, there is a vmtk script for that contributed to vmtk by Hugo Gratama van Andel:

vmtkimagecurvedmpr

(mpr stands for multi-planar reformat)

Make sure you first run your centerlines through vmtkcenterlinegeometry and vmtkcenterlineattributes, this way

vmtkcenterlinegeometry -ifile your_centerlines.vtp --pipe vmtkcenterlineattributes --pipe vmtkimagecurvedmpr -ifile your_image.mha -ofile sliced_image.mha

Cheers,


Luca
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk_______________________________________________
> vmtk-users mailing list
> vmtk-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vmtk-users


zhangx29

unread,
Aug 27, 2013, 12:39:49 PM8/27/13
to vmtk-...@googlegroups.com, Xiaoli Zhang, vmtk-...@lists.sourceforge.net
Hi Luca,

That is exactly what I want to achieve. My ultimate goal is make an animation showing the perpendicular slice moving along the centerline, at the same time, reformatted cross-sectional image on a different panel.

I tried to run the script on my data. It gave me a segmentation fault when executing vmtkimagecurvedmpr without further information. One thing I want to mention is that the input data format I used not hda but a vti (our original format mnc, and I convert it to vti). Would you be able to give me some hint on how to solve this? I can upload my data set if needed. Thanks in advance.

Xiaoli

Luca Antiga

unread,
Aug 28, 2013, 3:46:36 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hello Xiaoli,
 (BTW, thanks for posting to the new group) make sure the image and centerlines are co-localized correctly when you run

vmtkrenderer --pipe vmtkimageviewer -ifile your_image.vti --pipe vmtksurfaceviewer -ifile your_centerlines.vtp

If they do, please send both files over and I'll take a look.

Best,

Luca

Yiemeng Hoi

unread,
Aug 28, 2013, 8:16:50 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Xiaoli,
If you have the segmented surface, have you tried vmtk centerlineresampling --pipe vmtkcenterlinesections? 

(Luca: I like the new group!)

Regards,
Yiemeng

--
You received this message because you are subscribed to the Google Groups "vmtk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vmtk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Luca Antiga

unread,
Aug 28, 2013, 8:19:38 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Yiemeng,
 excellent suggestion, that might be it.
(Glad you like the group!)

Luca
To unsubscribe from this group and stop receiving emails from it, send an email to vmtk-users+unsubscribe@googlegroups.com.

zhangx29

unread,
Aug 28, 2013, 9:53:26 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Yiemeng,

Thanks for the suggestion. I am not particular familiar with vmtkcenterlinesections. I only know it is used to get vessel diameter with segmented vessel surface and its centerline, like this

vmtkcenterlinesections -ifile surface.vtp -centerlinesfile centerline.vtp -ocenterlinesfile out.dat

Would you mind elaborate the script you would run to get cross-sectional image to the centerline? Thanks.

Xiaoli
To unsubscribe from this group and stop receiving emails from it, send an email to vmtk-users+unsubscribe@googlegroups.com.

zhangx29

unread,
Aug 28, 2013, 9:59:38 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Luca,

Thanks for the tip. I have tried this and it seems my centerline and image are co-localized. Would you mind explain a bit more about how to use vmtkcenterlinesections to achieve this as Yiemeng suggested? If that doesn't work I will send you the image and centerline files.

Thanks,
Xiaoli

Yiemeng Hoi

unread,
Aug 28, 2013, 10:16:18 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Xiaoli,
Try these steps to see the process of making the sections along the centerline

vmtkcenterlineresampling -ifile <original_centerline> -ofile <resampled_centerline> 

vmtkcenterlinesections -ifile <surface_file> -centerlinesfile <resampled_centerline> -ofile <sections_along_centerline> 

vmtksurfaceviewer -ifile <sections_along_centerline> 


Or  

vmtkcenterlines -ifile <surface_file> --pipe vmtkcenterlineresampling --pipe vmtkcenterlinesections -i @vmtkcenterline.i -centerlines @vmtkcenterlineresampling.o --pipe vmtksurfaceviewer -i @vmtkcenterlinesections.o 


You may want to check vmtkcenterlineresampling to see if you can define the number of sections. 


Regards,
-- Yiemeng


--
You received this message because you are subscribed to the Google Groups "vmtk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vmtk-users+...@googlegroups.com.
To post to this group, send email to vmtk-...@googlegroups.com.

zhangx29

unread,
Aug 28, 2013, 10:40:52 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Yiemeng,

Thanks for the quick response. I tried your scripts and they does work on my dataset. However, the results are showing the cross-section of the segmented surface. I would like to show segmented original grayscale image instead. Is there a way to do it? From what I can see, vmtkcenterlinesections only take surface file (vtp) as input, but for my purpose I need to input a image file (vti).

Thanks,
Xiaoli

Yiemeng Hoi

unread,
Aug 28, 2013, 10:51:50 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Xiaoli,
Looks like you want to take the raw image, reformat it and output it in image format. Then, I suggest you follow Luca's advice on vmtkimagecurvedmpr. Perhaps, you may want to try Luca's advice with a smaller VOI if the full-set of image fails.


Regards,
-- Yiemeng

Luca Antiga

unread,
Aug 28, 2013, 10:54:00 AM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Xiaoli,
 I see, it looks like you really need vmtkimagecurvedmpr. However, I think the resampling hint from Yiemeng still holds. Try the following


vmtkcenterlineresampling -ifile <original_centerline> -ofile <resampled_centerline> 

vmtkcenterlinegeometry -ifile <resampled_centerline> --pipe vmtkcenterlineattributes --pipe vmtkimagecurvedmpr -ifile your_image.mha -ofile sliced_image.mha

If this crashes, then feel free to post the data.

Best,

Luca

zhangx29

unread,
Aug 28, 2013, 12:22:08 PM8/28/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Luca,

I have tried this and it still causes segmentation fault. I have attached a crop version of the centerline and grayscale image files. I would appreciate if you can take a look at it. Thanks.

Xiaoli
C12N4_grayscale_crop.vti
C12N4_label_crop.ls2.mc.sm.cl.vtp

Luca Antiga

unread,
Sep 4, 2013, 5:59:16 AM9/4/13
to vmtk-...@googlegroups.com, Xiaoli Zhang
Hi Xiaoli,
 sorry for the wait. I could successfully generate the multiplanar reformat with your data using the following script

vmtkcenterlineresampling -length 0.01 -ifile C12N4_label_crop.ls2.mc.sm.cl.vtp --pipe vmtkcenterlineattributes --pipe vmtkcenterlinegeometry --pipe vmtkimagecurvedmpr -ifile C12N4_grayscale_crop.vti -size 1000 -spacing 0.01 -ofile reformat.vti --pipe vmtkimageviewer

Let me know if this works for you and if you need clarifications on the above pipe (in any case all the options are documented).

Cheers

Luca

Xiaoli Zhang

unread,
Sep 4, 2013, 2:26:04 PM9/4/13
to vmtk-...@googlegroups.com
Hi Luca,

Thanks for your reply. I did try your script and the first time I still got the segmentation fault. Tried the same script on the same dataset another twice and they both worked. It seems a bit weird to me. But I am assuming it is working for now, I will need to try it on more high-resolution datasets.

One related question: how to convert the output vti file to NifTI/Analyze (nii) file format? I need to import the file into CEI Ensight and it seems NifTI is the only grayscale option for me. Thanks in advance.

Xiaoli

Luca Antiga

unread,
Sep 6, 2013, 4:48:10 PM9/6/13
to vmtk-...@googlegroups.com
Hello Xiaoli,
 I didn't get the crashes while I was running the script, it would be interesting to understand what's going on (are you on Windows by any chance?).

As for the conversion, just change the filename extension to .nii instead of .vti (e.g. -ofile output.nii). That will do the trick.

Best,

Luca

zhangx29

unread,
Sep 6, 2013, 9:25:51 PM9/6/13
to vmtk-...@googlegroups.com
I am running vmtk on Linux (Ubuntu 10.04 LTS 64-bit). Thanks for the tips to output as NifTI format.

Regards,
Xiaoli

Mojtaba Masoudi

unread,
Feb 26, 2020, 9:47:11 AM2/26/20
to vmtk-users
Hello,

I have the same problem. I tried to run your script about "vmtkimagecurvedmpr" on my computer (windows 10), but id dosen't work. the process finished with no output and this error "Process finished with exit code -1073741819 (0xC0000005)"

could you please help me. I downloaded your data and tried the following script:

vmtkcenterlineresampling -length 0.01 -ifile C12N4_label_crop.ls2.mc.sm.cl.
vtp --pipe vmtkcenterlineattributes --pipe vmtkcenterlinegeometry --pipe vmtkimagecurvedmpr -ifile C12N4_grayscale_crop.vti -size 1000 -spacing 0.01 -ofile reformat.vti --pipe vmtkimageviewer


Thanks a lot
Reply all
Reply to author
Forward
0 new messages