|
39 | 39 | if kwargs['interpolator'] != None and kwargs['resampledPixelSpacing'] != None: |
40 | 40 | image, mask = imageoperations.resampleImage(image, mask, kwargs['resampledPixelSpacing'], kwargs['interpolator']) |
41 | 41 | else: |
42 | | - image, mask = imageoperations.cropToTumorMask(image, mask) |
| 42 | + image, mask, bb = imageoperations.cropToTumorMask(image, mask) |
43 | 43 |
|
44 | 44 | # |
45 | 45 | # Show the first order feature calculations |
|
143 | 143 | # |
144 | 144 | if applyLog: |
145 | 145 | sigmaValues = numpy.arange(5., 0., -.5)[::1] |
146 | | - for sigma in sigmaValues: |
147 | | - logImage = imageoperations.applyLoG(image, sigmaValue=sigma) |
148 | | - logFirstorderFeatures = firstorder.RadiomicsFirstOrder(logImage, mask, **kwargs) |
| 146 | + for logImage, inputImageName, inputKwargs in imageoperations.applyFilterLoG(image, sigma=sigmaValues, verbose=True): |
| 147 | + logFirstorderFeatures = firstorder.RadiomicsFirstOrder(logImage, mask, **inputKwargs) |
149 | 148 | logFirstorderFeatures.enableAllFeatures() |
150 | 149 | logFirstorderFeatures.calculateFeatures() |
151 | | - print 'Calculated firstorder features with LoG sigma ', sigma |
152 | 150 | for (key, val) in logFirstorderFeatures.featureValues.iteritems(): |
153 | | - laplacianFeatureName = 'LoG-sigma-%s_%s' % (str(sigma), key) |
| 151 | + laplacianFeatureName = '%s_%s' % (inputImageName, key) |
154 | 152 | print ' ', laplacianFeatureName, ':', val |
155 | 153 | # |
156 | 154 | # Show FirstOrder features, calculated on a wavelet filtered image |
157 | 155 | # |
158 | 156 | if applyWavelet: |
159 | | - ret, approx = imageoperations.swt3(image) |
160 | | - |
161 | | - for idx, wl in enumerate(ret, start=1): |
162 | | - for decompositionName, decompositionImage in wl.items(): |
163 | | - waveletFirstOrderFeaturs = firstorder.RadiomicsFirstOrder(decompositionImage, mask, **kwargs) |
164 | | - waveletFirstOrderFeaturs.enableAllFeatures() |
165 | | - waveletFirstOrderFeaturs.calculateFeatures() |
166 | | - print 'Calculated firstorder features with wavelet ', decompositionName |
167 | | - for (key, val) in waveletFirstOrderFeaturs.featureValues.iteritems(): |
168 | | - waveletFeatureName = 'wavelet-%s_%s' % (str(decompositionName), key) |
169 | | - print ' ', waveletFeatureName, ':', val |
170 | | - |
171 | | - waveletFirstOrderFeaturs = firstorder.RadiomicsFirstOrder(approx, mask, **kwargs) |
172 | | - waveletFirstOrderFeaturs.enableAllFeatures() |
173 | | - waveletFirstOrderFeaturs.calculateFeatures() |
174 | | - print 'Calculated firstorder features with approximation of wavelt (= LLL decomposition)' |
175 | | - for (key, val) in waveletFirstOrderFeaturs.featureValues.iteritems(): |
176 | | - waveletFeatureName = 'wavelet-LLL_%s' % (key) |
177 | | - print ' ', waveletFeatureName, ':', val |
| 157 | + for decompositionImage, decompositionName, inputKwargs in imageoperations.applyFilterWavelet(image): |
| 158 | + waveletFirstOrderFeaturs = firstorder.RadiomicsFirstOrder(decompositionImage, mask, **inputKwargs) |
| 159 | + waveletFirstOrderFeaturs.enableAllFeatures() |
| 160 | + waveletFirstOrderFeaturs.calculateFeatures() |
| 161 | + print 'Calculated firstorder features with wavelet ', decompositionName |
| 162 | + for (key, val) in waveletFirstOrderFeaturs.featureValues.iteritems(): |
| 163 | + waveletFeatureName = 'wavelet-%s_%s' % (str(decompositionName), key) |
| 164 | + print ' ', waveletFeatureName, ':', val |
0 commit comments