This is a temporary issue, we are just waiting for @raul to approve this pull request that contains the fix:
Ok thank you @lassoan
On another note, I have been trying to create histograms for my own CT chest studies in Parenchymal Analysis Module using the steps laid out by @rbumm .
However, there always seems to be a spike in frequency at HU -1024. I have tried a few different CT studies
This does not appear to be an issue for the DemoCTChest sample data. Is there a reason for it?
-1000 HU corresponds to air, if you are interested in soft tissue density then you can ignore that peak.
In that case, shouldn’t the CTchest sample data also have the same peak to correspond to air? But as you can see in the image below, the sample data does not have the peak at -1024 HU. Instead, the peak is at ~HU-900. Also, the peak is smooth and not as sharp as mine.
I am all for ignoring it but I am worried that there might actually be erroneous data being generated.
Probably all voxels below -1024 is lumped into the that -1024 bin. As you can see, the peak does not go down all the way to 0 at that density value (either the image is darker or more of the air voxels are included in the segmentation), you see one large value. Probably you could eliminate this by reducing the lower range from -1024 to -1200 or so, or by adjusting the segmentation to include less “air” voxels.
Ok thanks for helping @lassoan. I tried using a wider threshold as you suggested (i.e. HU -1200) and also ensuring that the segmentation is as accurate as possible to exclude air that is not lungs but it still does not work.
I think ideally it should have looked like the histogram in the 3D slicer sample data as this is what normal lung histogram looks like as seen below (peaking at about ~HU -900 without any spurious spike). I think the main issue is whether the other calculations (e.g. mean, skewness, kurtosis, perc) will be significantly affected by this spike.
I will try on more studies but so far I am not getting it to work.
On another note, would you happen to know when @raul will be approving the pull request?
Thanks alot!
You haven’t changed the histogram bin lower range from -1024. Changing the plot view’s zoom does not change the histogram bins. If adjusting the histogram bin range is not exposed on the GUI then you need to edit the Python script of the module.
Oh yes, I just realized that as well. I had a look at the script. It seems that there is no lower limit for the histogram. Is this correct?
Anyway, it still does not make sense as I feel that lungs should not have any density at or lower than HU -1024 if they are normal. We can see from the sample data that the range of densities does not come close to HU -1000.
It all looks good to me. Probably the WholeLung segment includes the trachea, which is all air. The intensity barely goes below -1024, maybe by 5 bins, which can be due to noise and slight miscalibration of the CT.
It is also interesting to note that the shape of the intensity histogram may depend on the resolution of the CT due to the partial volume effect. A higher-resolution scan will contain more voxels that are completely filled with air, therefore the histogram will have a thicker tail (more voxels with approximately -1000 HU).
I get the same vertical histogram bar at -1024 … obviously, the voxel intensities at and below -1024 seem to be pooled at this value.
Threshold segmentation (range -1024 to -1024):
Thanks @rbumm and @lassoan ! Yes I tried a few more cases and even used another program to test. All of them return a spike and it is likely due to the smaller airways or air pockets that we cannot exclude. I might have to adjust the threshold higher if I want to remove the spike.
Thanks again!
Checked this out a little further and - sorry to say - I can not reproduce the disturbing vertical spike at -1024 when implementing my own histogram chart with scatterbars in the LungCTAnalyzer:
Tested several CTs with the new function not showing a spike. Unfortunately, I can not check this against Parenchyma Analysis of CIP because although CIP can be loaded with yesterday’s Slicer preview (4.13.0-2021-12-17 r30503 / fff83f9) it results in all kinds of error messages, and Parenchyma Analysis is not initialized.
So if you all agree I will probably include a histogram table and chart production as an additional output in LungCTAnalyzer.
It is better to fix the existing Parenchyma analyzer module than duplicating the feature in Lung CT analyzer: it keeps lung CT analyzer module slightly sinpler and significantly reduces maintenance workload (no need to maintain the same feature in two places).
Happy new year, @lassoan.
It is better to fix the existing Parenchyma analyzer module
Although I was a bit reluctant (possible delays of getting CIP PR’s accepted) I was able to fork and locally build Slicer_CIP, as far as I see without errors. Now I am stuck on how to locally install this extension build in my recently compiled Slicer from disk. How would you recommend doing so? Use the Developer Tools → Extension Wizard or is there a command-line option?
I usually just add the module folders to “additional module paths” in application settings. See some more details here: Extensions — 3D Slicer documentation
Great, works.
It turns out that loading the current Slicer_CIP in two recent Slicer previews throws seven “No module named Editor” exceptions like this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\D\S4R\python-install\Lib\imp.py", line 170, in load_source
module = _exec(spec, sys.modules[name])
File "<frozen importlib._bootstrap>", line 618, in _exec
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:/D_CIP/SlicerCIP/SlicerCIP-build/inner-build/lib/Slicer-4.13/qt-scripted-modules/CIP_RVLVRatio.py", line 10, in <module>
from CIP.ui import CaseReportsWidget
File "C:\D_CIP\SlicerCIP\SlicerCIP-build\inner-build\lib\Slicer-4.13\qt-scripted-modules\CIP\ui\__init__.py", line 1, in <module>
from .CIP_EditorWidget import CIP_EditorWidget
File "C:\D_CIP\SlicerCIP\SlicerCIP-build\inner-build\lib\Slicer-4.13\qt-scripted-modules\CIP\ui\CIP_EditorWidget.py", line 7, in <module>
from Editor import EditorWidget
ModuleNotFoundError: No module named 'Editor'
Probably easy to solve ?
The Editor module has been removed from Slicer. The replacement may not be trivial, but should improve the extension. This may be a good task for the upcoming project week.
@rbumm For the spike, I realized it depends on what kernel the images were acquired in. If I used images reconstructed with smooth kernel (soft tissue window), the spikes will not be there. But if I used images reconstructed with lung kernel (lung window), then the spikes will be there.
Lung Kernel example:
Smooth kernel example of same patient:
Not sure if that helps.
By the way, @lassoan do you know if the parenchyma analysis module has been fixed?
Forget about that peak. You can safely ignore that. The segment have thousands of voxels and the peak is just a few dozens voxels.
It was a long time ago, but I think it works well in current Slicer Preview Release.