Thresholding .mha Before DRR Generation

32 views
Skip to first unread message

Andrew Fields

unread,
Nov 7, 2022, 3:18:22 PM11/7/22
to Plastimatch
Hi Plastimatch community, 

I am attempting to generate high-quality DRRs of the lumbar spine from thin slice CT volumes. I have selected satisfactory values for nrm, o, and vup, but the margins of the vertebrae are not easily visualized in the resulting DRR (pfm) in GIMP. 

In the Plastimatch module in 3D Slicer (Plastimatch>Reconstruct>DRR generation), there is a "Threshold below" option that helps to improve visibility of the bony anatomy by controlling to zero the intensity values associated with the soft tissues. Is there a similar thresholding feature in the plastimatch drr command?

I tried using the plastimatch threshold command to control the range of intensities in the .mha that is inputted into plastimatch drr, but the resulting DRR (pfm) is almost all white when viewed in GIMP. 

Thanks, 
Andrew 

Sharp, Gregory C.

unread,
Nov 7, 2022, 4:27:54 PM11/7/22
to Plastimatch
Hi Andrew,
The threshold function creates a binary mask. You would need to use plastimatch fill as well if you want to go that route. My recommendation is to use plastimatch adjust because it saves the extra step.

Plastimatch adjust can perform a piecewise linear mapping. If, for example, you wanted to set all soft tissue with HU less than 300 to value -1000, you would do this:

plastimatch adjust --pw-linear "-inf,0,300,-1000,301,301,inf,1"

The inf and negative inf are paired with a slope rather than a value. That is, for input intensities below 300, the slope is zero and all values map to -1000. For input val,ues above 301, the slope is one, and all values map to themselves.
Greg

________________________________________
From: plast...@googlegroups.com <plast...@googlegroups.com> on behalf of Andrew Fields <robertand...@gmail.com>
Sent: Monday, November 7, 2022 3:18 PM
To: Plastimatch
Subject: [Plastimatch] Thresholding .mha Before DRR Generation

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<mailto:plastimatch...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/plastimatch/f0521897-e571-4f28-b4c6-65b4afc949c9n%40googlegroups.com<https://secure-web.cisco.com/1T8iQbFrqCMjdEzV9wzjqCT44MBK_9t0TzIbtcgQKZL-WOeeph0749mm2Lto0TKGNWoplBKRPL0QakxuVBCNFHjHWwlRtDrixtQOqUIItHgI5v-tm4bdAxCZWWNZwnBM8PPFx771I537_m2aqyF5NrkatTFvnoMAFkP4yfJHoAHHjxxWwwwaA4R2-Xr-lE21OPylgei-kkpw-tbM-fCGG-EOdVJxzJkW9b4wJL31-mjG4kNc9ngarBBRZnYD05ZGR2Y_Aiy1kJLBv16V8mFaFzHXQ51IQ1KwXaf2L3SdhgqGndVZyZswkPT8aNcX7V7M5u2eqni8fmX0MAn8wcOvt4Q/https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fplastimatch%2Ff0521897-e571-4f28-b4c6-65b4afc949c9n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter>.
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 <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.

Andrew Fields

unread,
Nov 8, 2022, 9:50:24 PM11/8/22
to plast...@googlegroups.com
Thank you, Greg, that worked like a charm. I appreciate you sharing the clear example with sample code--that really saved me from struggling with the pw-linear parameters. 

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/lhhqjwN_X18/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/BL0PR04MB459324351B484686FF20CF2ACF3C9%40BL0PR04MB4593.namprd04.prod.outlook.com.

Andrew Fields

unread,
Nov 9, 2022, 2:31:16 PM11/9/22
to plast...@googlegroups.com
Hi Greg, 

I have a follow-up question about using the Adjust command. It seems like applying Adjust decreases the resolution of a downstream DRR (more pixelation, less definition of anatomical contours). See example below. The image on the left is a DRR generated from an .mha that was created directly from a .dcm series. The image on the right is a DRR generated from an .mha that is a modified version of the initial .mha.   
image.png
The settings for the Adjust command were:  --pw-linear "-inf,0,66,-1000,67,67,inf,1"

Is it my imagination? If not, is there a way to avoid this?

Andrew 

On Mon, Nov 7, 2022 at 3:27 PM Sharp, Gregory C. <GCS...@partners.org> wrote:
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/lhhqjwN_X18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plastimatch...@googlegroups.com.
Image quality change.png

Sharp, Gregory C.

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

Hi Andrew,

 

I expect no difference in resolution.

 

The adjust command creates an output image with the same resolution as the input image.  There is one exception though, when converting images that have irregular slice spacing.  You can check the resolution like follows:

 

plastimatch header --input adjusted.mha

plastimatch header --input DICOM/

 

The adjust command will convert the volume from integer to floating point as well, but I doubt that is harming things.  You could check this by doing a "null" adjustment:

 

plastimatch adjust --pw-linear "0,0"    # If you don't specify the -inf/inf parts the slope is 1

 

And then compare the DRR output with the original.

 

I'm not familiar with the Slicer UI.  It is possible they are doing something clever like oversampling the volume.  But I consider it more likely that some useful anatomic features are being set to -1000 and not showing up.  If so, this is not easy to correct.  It does make sense that the adjusted DRR is noisier due to fewer voxels being used in each ray.

 

Let me know what you find out.

Greg

 

From: plast...@googlegroups.com <plast...@googlegroups.com> On Behalf Of Andrew Fields
Sent: Wednesday, November 09, 2022 2:31 PM
To: plast...@googlegroups.com
Subject: Re: [Plastimatch] Thresholding .mha Before DRR Generation

 

        External Email - Use Caution        

Hi Greg, 

 

I have a follow-up question about using the Adjust command. It seems like applying Adjust decreases the resolution of a downstream DRR (more pixelation, less definition of anatomical contours). See example below. The image on the left is a DRR generated from an .mha that was created directly from a .dcm series. The image on the right is a DRR generated from an .mha that is a modified version of the initial .mha.   

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/CAARQgai0aeQqqizDGZZ11rxaowqjd_AXrWgg7E%2Bk1DE4dynaUw%40mail.gmail.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 .

Reply all
Reply to author
Forward
0 new messages