Nightly Build & 2D feature extraction Problem

154 views
Skip to first unread message

Harika

unread,
May 3, 2019, 9:56:49 AM5/3/19
to pyradiomics
Hi,

Actually I have 2 main questions. I hope someone can help me.

1) I've trying to use pyradiomics in 3D slicer and since it was mentioned in the begining, I downloaded Nightly Built version ( version 4.11.0 revision 28202 built 2019-05-03), I added radiomics plugin, but whenever I try to use it, I get an error like this: 

Traceback (most recent call last):

File "C:/Users/Lenovo/AppData/Roaming/NA-MIC/Extensions-28202/SlicerRadiomics/lib/Slicer-4.11/qt-scripted-modules/SlicerRadiomics.py", line 65, in setup

self._addCustomizationSection()

File "C:/Users/Lenovo/AppData/Roaming/NA-MIC/Extensions-28202/SlicerRadiomics/lib/Slicer-4.11/qt-scripted-modules/SlicerRadiomics.py", line 202, in _addCustomizationSection

self.featuresButtonGroup.setId(featureButtons[feature], self.features.index(feature))

AttributeError: 'dict_keys' object has no attribute 'index'


I wondered if I download and work on Stable Release version 4.10.1, would it be the same situation. And I could get results from it. Can I use this version instead of Nightly built or is nightly built necessary to get correct results?


2) My second problem is about 2D images. I'm also trying to use this module for feature extraction but I want to do it for 2D CT images. I load just one slice(axial) and when I run it (both in Nightly built and stable release), gives me 3D-based results( for example I want to obtain wavelet function and the programe gives me LLL-HHH...since it is 2D, it should be LL_HH..etc.) and also this is written in settings part of table: 


{'distances': [1], 'additionalInfo': True, 'force2D': False, 'interpolator': 'sitkBSpline', 'resampledPixelSpacing': None, 'label': 1, 'normalizeScale': 1, 'normalize': False, 'force2Ddimension': 0, 'removeOutliers': None, 'minimumROISize': None, u'binWidth': 25.0, 'minimumROIDimensions': 2, u'correctMask': True, 'preCrop': False, u'symmetricalGLCM': True, 'resegmentRange': None, 'padDistance': 5}


Since I dont know how to use Phyton, I searched my options online and I tried to use manual command as force2D=true, but it didnt work. I wonder that did I use wrong command? or did I use it wrongly? what is the best option to get 2D feature extraction? 



Joost van Griethuysen

unread,
May 3, 2019, 10:10:15 AM5/3/19
to pyradiomics
Hello,

ad 1) This is a bug due to the transition to Python 3. I've fixed the bug, which should be included in tonight's nightly build.

ad 2) You can access the extended customization options by using a PyRadiomics parameter file. This is a human-readable structured text file (yaml). See here for info on the customization in PyRadiomics and how to build the parameter file. Furthermore, here are some examples of the parameter file.

Regards,

Joost

Op vrijdag 3 mei 2019 15:56:49 UTC+2 schreef Harika:

Harika

unread,
May 3, 2019, 10:49:04 AM5/3/19
to pyradiomics

Hi Joost,
First, thanks for this fast responding. I'll be waiting for the version.

For my second problem, I couldnt find examplessettings file in examples file which was mentioned in the page. I'll look the page you sent me again while I'll be waiting for the fixed nightly build version, but I still cant fix force2D=true part. Maybe the problem is the way I write the command I dont know. I write is like force2D=true I also tried force2D=[True], but the results didn't change.

Best Regards,
Harika.

3 Mayıs 2019 Cuma 17:10:15 UTC+3 tarihinde Joost van Griethuysen yazdı:

Harika

unread,
May 3, 2019, 12:27:36 PM5/3/19
to pyradiomics
Now the file is opened. I'll examine all examples and when the nightly build is ready, I'll try again.
Thanks,
Regards,
Harika.

Harika

unread,
May 4, 2019, 4:24:32 PM5/4/19
to pyradiomics
Hello Joost,
I tried the nightly build again and this error was generated when I tried to use Radiomics:

Feature calculation failed.

Traceback (most recent call last):

File "C:/Users/Lenovo/AppData/Roaming/NA-MIC/Extensions-28202/SlicerRadiomics/lib/Slicer-4.11/qt-scripted-modules/SlicerRadiomics.py", line 405, in onApplyButton

self.onFinished)

File "C:/Users/Lenovo/AppData/Roaming/NA-MIC/Extensions-28202/SlicerRadiomics/lib/Slicer-4.11/qt-scripted-modules/SlicerRadiomics.py", line 735, in runCLI

self.runCLIWithParameterFile(imageNode, maskNode, tableNode, parameterFile, callback)

File "C:/Users/Lenovo/AppData/Roaming/NA-MIC/Extensions-28202/SlicerRadiomics/lib/Slicer-4.11/qt-scripted-modules/SlicerRadiomics.py", line 773, in runCLIWithParameterFile

self._startCLI(firstRun=True)

File "C:/Users/Lenovo/AppData/Roaming/NA-MIC/Extensions-28202/SlicerRadiomics/lib/Slicer-4.11/qt-scripted-modules/SlicerRadiomics.py", line 531, in _startCLI

labelName, labelNode, label_idx, imageNode = self._labelGenerators.next()

AttributeError: 'itertools.chain' object has no attribute 'next'


Is nightly built necessary to use this plugin or also 4.10 version could be usable?

Regards,
Harika.


3 Mayıs 2019 Cuma 17:10:15 UTC+3 tarihinde Joost van Griethuysen yazdı:
Hello,

tenzin kunkyab

unread,
May 15, 2019, 9:15:00 PM5/15/19
to pyradiomics
Hi Harika and Joost,

I am having the same problem, 

were you able to solve it? I can't use nightly version, I have to use stable release...

I am thinking of doing the segmentation in 3d slicer and then convert the image to nrrd format to be able to run via PyRadiomics script. But if 3d slicer works that's the best option for me. 

best
Tenzin

Joost van Griethuysen

unread,
May 16, 2019, 4:26:32 AM5/16/19
to pyradiomics
Hello Tenzin,

What exactly is your error?
The problem listed here stem from Python3 compatibility issues. However, the latest stable release (4.10.1) still uses Python 2.7.13.

Regards,

Joost

Op donderdag 16 mei 2019 03:15:00 UTC+2 schreef tenzin kunkyab:

Joost van Griethuysen

unread,
May 16, 2019, 9:40:09 AM5/16/19
to pyradiomics
Hello Harika, Tenzin,

I've found a bug in the code, which is regardless of python version. The error shows as follows:

Traceback (most recent call last):


 

 
File "C:\Users\j.v.griethuysen\AppData\Roaming\NA-MIC\Extensions-28226\SlicerRadiomics\Lib\site-packages\radiomics\scripts\segment.py", line 68, in _extractFeatures

 feature_vector
.update(extractor.execute(imageFilepath, maskFilepath, label, label_channel))

 
File "C:\Users\j.v.griethuysen\AppData\Roaming\NA-MIC\Extensions-28226\SlicerRadiomics\Lib\site-packages\radiomics\featureextractor.py", line 271, in execute

 boundingBox
, correctedMask = imageoperations.checkMask(image, mask, **self.settings)

 
File "C:\Users\j.v.griethuysen\AppData\Roaming\NA-MIC\Extensions-28226\SlicerRadiomics\Lib\site-packages\radiomics\imageoperations.py", line 238, in checkMask

 
raise ValueError('Image/Mask datatype or size mismatch. Potential fix: enable correctMask, see '

ValueError: Image/Mask datatype or size mismatch. Potential fix: enable correctMask, see Documentation:Usage:Customizing the Extraction:Settings:correctMask for more information



This error occurs because slicer stores cropped versions of the mask to conserve space (because of the geometric information contained in the images, a good alignment can still be achieved).
However, PyRadiomics checks if image and mask have identical size and geometric information. If not, this error is raised. PyRadiomics does also contain code that enables resampling of the mask to the image space, but this is disabled by default to ensure users are aware of inconsistencies in their data (i.e. prevent silent bugs and mismatches). When parameter correctMask=True, PyRadiomics will check if the mask is contained within the image bounds and if so, resample the mask to the image space.

When using manual customization, this error is prevented, because as part of the customization, the correctMask parameter is set to true. However, this is currently not the case when using the parameter file.
Therefore, to fix your error, ensure that is included correctMask: True in your parameter file (secition setting). I will apply a bugfix to the code, but this will then only be incorporated into the next nightly build/stable release.

Regards,

Joost


Op donderdag 16 mei 2019 10:26:32 UTC+2 schreef Joost van Griethuysen:

tenzin kunkyab

unread,
May 16, 2019, 1:48:56 PM5/16/19
to Joost van Griethuysen, pyradiomics
Hi Joost,

For now I am just playing around with segmentation and getting some radiomics feature (familiarizing with 3D slicer too). I did a quick example of manual segmentation and tried to use the radiomics extension in 3d Slicer and I get the following error. 

Please let me know how I can fix this.

best
Tenzin

--
You received this message because you are subscribed to the Google Groups "pyradiomics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyradiomics...@googlegroups.com.
To post to this group, send email to pyrad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyradiomics/7c14c5d8-e3a5-4133-abcc-89abac567192%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Capture.PNG

Joost van Griethuysen

unread,
May 17, 2019, 6:47:04 AM5/17/19
to pyradiomics
Hello Tenzin,

From your capture it does look like you are using the Nightly Build (currently 4.11). The stable release is 4.10.
The error you are getting is due to it being a slightly older nightly build, that does not get the SlicerRadiomics with the compatibility fix I made (every nightly build has it's own set of extensions).

Therefore you can do one of 2 things: download and install the stable release (with Python 2.7) or install the latest  nightly build, which has a fix for the compatibility bug.

Alternatively, you could edit the SlicerRadiomics files directly, but it would need some searching etc. In your capture you can see in where in which file it is going wrong (last line of the stack trace). There, you have to replace the .next() with .__next__().

Regards,

Joost

Op donderdag 16 mei 2019 19:48:56 UTC+2 schreef tenzin kunkyab:
To unsubscribe from this group and stop receiving emails from it, send an email to pyradiomics+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages