PFM Conversion

22 views
Skip to first unread message

Andrew Fields

unread,
Nov 9, 2022, 1:01:13 PM11/9/22
to Plastimatch
Hi Plastimatch community, 

I am using the DRR function to create simulated x-rays of the spine and the files need to be formatted as .png or .jpeg for my application. What is the optimal way for converting from a Plastimatch output format (pfm, pgm, or raw) into .png or .jpeg?

Right now, I am using the Plastimatch command prompt to output .pfm files, opening the .pfm files in GIMP, and exporting them as .png files with the default export parameters. It is functional, but a bit clunky. 

Andrew 

Sharp, Gregory C.

unread,
Nov 9, 2022, 3:26:52 PM11/9/22
to plast...@googlegroups.com

Hi Andrew,

 

I think you could use the imagemagick convert program.

 

But even better, I should refactor that code.  It is ancient, circa 2003, before ITK was required.  Now that ITK is required, we should use it!

 

Greg

 

From: plast...@googlegroups.com <plast...@googlegroups.com> On Behalf Of Andrew Fields
Sent: Wednesday, November 09, 2022 1:01 PM
To: Plastimatch <plast...@googlegroups.com>
Subject: [Plastimatch] PFM Conversion

 

        External Email - Use Caution        

--
You received this message because you are subscribed to the Google Groups "Plastimatch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plastimatch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plastimatch/d8f69cc2-cda7-40e4-9bd8-42a10ca37af8n%40googlegroups.com.

The information in this e-mail is intended only for the person to whom it is addressed.  If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline .


Please note that this e-mail is not secure (encrypted).  If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately.  Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail. 

Paolo Zaffino

unread,
Nov 10, 2022, 8:30:58 AM11/10/22
to plast...@googlegroups.com
Hi all,
some years ago I wrote a python code for converting the pfm file into a numpy matrix.
At this point you can easily save the numpy matrix as image (eg by using skimage)
The code is already in the plastimatch source:
https://gitlab.com/plastimatch/plastimatch/-/blob/master/extra/python/pfm.py

I wrote it 7 years ago, so maybe something changed in the libraries.
Let me know if it works.

Best,
Paolo

Andrew Fields

unread,
Nov 10, 2022, 10:39:06 AM11/10/22
to plast...@googlegroups.com
Thank you for the recommendations, George and Paolo!

Andrew 

You received this message because you are subscribed to a topic in the Google Groups "Plastimatch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plastimatch/iBkDCdICk68/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plastimatch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plastimatch/a12f54bd-db47-2f27-1df0-c92787e9f009%40yahoo.it.
Reply all
Reply to author
Forward
0 new messages