# Binwidth Optimization

**URL:** <https://discourse.slicer.org/t/binwidth-optimization/15996>\
**Category:** Radiomics\
**Tags:** segmentation\
**Created:** [February 15, 2021, 3:26pm UTC](https://discourse.slicer.org/t/binwidth-optimization/15996 "2021-02-15T15:26:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ceylan](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@Ceylan](https://discourse.slicer.org/u/Ceylan)\
**Post date:** [February 15, 2021, 3:26pm UTC](https://discourse.slicer.org/t/binwidth-optimization/15996/1 "2021-02-15T15:26:57Z")

</div>

Hello everyone,

I’m trying to extract the radiomic features from MR images using Pyradiomics extension on 3DSlicer.

I know that the default setting for the binwidth is 25. However, I am not sure which value is more suitable for my studies. How can I optimize this value? Some features cannot be calculated when I use the default value.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![JoostJM](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joostjm/32/1091_2.png) [@JoostJM](https://discourse.slicer.org/u/JoostJM)\
**Post date:** [March 9, 2021, 12:20pm UTC](https://discourse.slicer.org/t/binwidth-optimization/15996/2 "2021-03-09T12:20:59Z")

</div>

1. Extract firstorder features for your dataset, with all preprocessing you intend to use.
2. Look at the value for firstorder - Range; choose a binwidth so, that for the majority of your scans, the binwidth will result in ~10-100 bins. So if your range is, saty [50 - 500], use binwidth 5.

---

<div class="post-metadata">

**Author:** ![Ceylan](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@Ceylan](https://discourse.slicer.org/u/Ceylan)\
**Post date:** [March 21, 2021, 2:27pm UTC](https://discourse.slicer.org/t/binwidth-optimization/15996/3 "2021-03-21T14:27:16Z")

</div>

Thank you for your kind answer.

I want to ask again, just to be sure.

In my FO Range, my minimum number is 1.46 and my maximum number is 7.58. What’s your suggestion for binwidth value?

---

<div class="post-metadata">

**Author:** ![JoostJM](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joostjm/32/1091_2.png) [@JoostJM](https://discourse.slicer.org/u/JoostJM)\
**Post date:** [March 22, 2021, 4:25pm UTC](https://discourse.slicer.org/t/binwidth-optimization/15996/4 "2021-03-22T16:25:46Z")

</div>

In that case, I would advise a binWidth of about 0.1, this will yield 15 bins for your minimum and 76 for your maximum, both of which are in the range of [10, 100] bins.

---

<div class="post-metadata">

**Author:** ![AMM](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amm/32/77876_2.png) [@AMM](https://discourse.slicer.org/u/AMM)\
**Post date:** [September 10, 2024, 11:40am UTC](https://discourse.slicer.org/t/binwidth-optimization/15996/5 "2024-09-10T11:40:29Z")

</div>

What if we have a range of [50 12000] or [10 1000]? We can garantee that both the min and max stand on the [10 100] interval. What should we do in those cases?
