zhenweishi / Py-rex

Open source of Pyradiomics extension
21 stars 13 forks source link

Pyradiomics #8

Open nsasanka opened 5 years ago

nsasanka commented 5 years ago

I am trying to find, which part of the two given codes runs the Pyradiomics. I dont see a pyradiomics command in either of the codes

ivanzhovannik commented 5 years ago

I am trying to find, which part of the two given codes runs the Pyradiomics. I dont see a pyradiomics command in either of the codes

Hi @nsasanka ,

I will try to answer your question. The code PyrexReader.py doesn't indeed contain a pyradiomics call, however, it generates the 3D image and the binary mask from your DICOM images and RTSTRUCT. This is performed by the function Image, Mask = Img_Bimask(img_path,rtstruct_path,ROI_name): # generating image array and binary mask.

You may then run something like:

#initialize the extractor object of pyradiomics extractor = radiomics.featureextractor.RadiomicsFeaturesExtractor(yourParamsFile)

#extract features RadiomicsDictionary = extractor.execute(Image, Mask)

Hope that helped! Ivan

zhenweishi commented 5 years ago

I am trying to find, which part of the two given codes runs the Pyradiomics. I dont see a pyradiomics command in either of the codes

@nsasanka sorry for my late reply. Py-rex was designed for I/O functionalities of pyradiomics. It consists of a collection of modules to make pyradiomics reads DICOM image and RTSTRUCT file, and output RDF. However, with the development, we found we could do more for radiomics/pyradiomics community, therefore we developed O-RAW (ontology-guided radiomics analysis workflow, which added more functionalities for radiomics analysis and make it easy to use. Please go to O-RAW repository: https://gitlab.com/UM-CDS/o-raw/ If you have further questions, please contact us.

nsasanka commented 5 years ago

Hi @ivanzhovannik , I am somewhat new to Python and all of this in general. However, I figured out how to reach till

RadiomicsDictionary = extractor.execute(Image, Mask)

I noticed that when I use the parameter file provided in this package it takes forever to run, Is this normal? Also, in the second part of your code PyrexOutput, is the variable featurevector the same as what you call RadiomicsDictionary in your previous comment? Will this code still work If I change my parameter file for pyradiomics? Could you provide an example usage of this code similar to the one given in PyrexReader.py.

Thanks Nishanth

ivanzhovannik commented 5 years ago

Hi @ivanzhovannik , I am somewhat new to Python and all of this in general. However, I figured out how to reach till

RadiomicsDictionary = extractor.execute(Image, Mask)

I noticed that when I use the parameter file provided in this package it takes forever to run, Is this normal?

Hi Nishanth,

Regarding the running time - the long running time is caused by pyradiomics generating new (filtered Lagrangian and Wavelet images) and extracting features from them as well as from the Original image.

imageType: Original: binWidth: 0.5 LoG: binWidth: 10 sigma: [1.0, 2.0, 3.0] Wavelet: binWidth: 5

If you do not need the filtered images, delete the imageType lines starting with LoG. Read more on filtering and customization here: https://github.com/Radiomics/pyradiomics/blob/master/docs/customization.rst

Also, in the second part of your code PyrexOutput, is the variable featurevector the same as what you call RadiomicsDictionary in your previous comment?

Indeed, they should be the same from my knowledge featureVector == RadiomicsDictionary, as pyradiomics has an OrderedDict object as its output.

Will this code still work If I change my parameter file for pyradiomics?

Try my suggestion above and test - it should work. Also, read https://github.com/Radiomics/pyradiomics/blob/master/docs/customization.rst and visit https://groups.google.com/forum/#!forum/pyradiomics.

Could you provide an example usage of this code similar to the one given in PyrexReader.py.

I am not sure if it is what you wanted

import PyrexReader import radiomics img_path = '.\CTscan' # folder of dicom images rtstruct_path = '.\RTstruct' # folder for RTSTRUCTs ROI = 'GTV' # can be any other name Img,Mask = PyrexReader.Img_Bimask(img_path,rtstruct_path,ROI) # create the 3D image and binary mask #initialize the extractor object of pyradiomics extractor = radiomics.featureextractor.RadiomicsFeaturesExtractor(yourParamsFile) #extract features RadiomicsDictionary = extractor.execute(Image, Mask)

nsasanka commented 5 years ago

@ivanzhovannik Thanks for your reply. I think you misunderstood when I asked for an example. I was asking for an example of the PyrexOutput code. I have one more question, Is there an example of Batch processing for PyrexReader code available somewhere?

Also regarding my question

Will this code still work If I change my parameter file for pyradiomics?

I meant PyrexOutput code , I am able to run and get results with the PyrexReader code Thanks Nishanth