CBICA / CaPTk

Cancer Imaging Phenomics Toolkit (CaPTk) is a software platform to perform image analysis and predictive modeling tasks. Documentation: https://cbica.github.io/CaPTk
https://www.cbica.upenn.edu/captk
Other
179 stars 64 forks source link

FeatureExtraction issue #264

Closed schakrab closed 5 years ago

schakrab commented 5 years ago

Hi Sarthak,

So in the nibabel documentation I see the following: "Nibabel images always use RAS+ output coordinates, regardless of the preferred output coordinates of the underlying format. For example, we convert affines for DICOM images to output RAS+ coordinates instead of LPS+ coordinates. We chose this convention because it is the most popular in neuroimaging; for example, it is the standard used by NIfTI and MINC formats."

Could this be part of the problem in using nibabel?

Best, Shuvam

sarthakpati commented 5 years ago

Hey Shuvam, that actually helped a lot. From what I saw, it is a 2D image which is initialized as a 3D image with a single slice (this is how CaPTk writes out temporary files). I have added a fix for this in my latest commit (https://github.com/sarthakpati/CaPTk/commit/0c9677223854c0aed283af4d27ea07ecd1120f3f) and it will be available in the new release. For the time being, you can simply extract the image information from the image and roi and write those into new "true" 2D images and then push it to FE for processing.

schakrab commented 5 years ago

Hi Sarthak, thanks for that. So do you think re-writing all the files as 2D images will enable the lattice computation, as the software is not programmed to overlay 3D lattices (even if the third dimension is size 1)?

sarthakpati commented 5 years ago

I was able to get that working with the current implementation.

schakrab commented 5 years ago

Great, I will try it out.

schakrab commented 5 years ago

Hi Sarthak,

So I converted to 2D and ran the same command, but now it seems to output the "Mask-resampled..." and "T1-resampled..." which seem to be copies of the original, and nothing else. What parameters did you use to get the feature maps to be printed, and could you send me a copy of the command? Here are the new 2D files, for reference.

20040524_080855ROUTINEs1480a000.nii.gz 20040524_080855ROUTINEs1480a000_roi.nii.gz

sarthakpati commented 5 years ago

Command:

FeatureExtraction.exe -n SHV -i C:\path_to_input\image.nii.gz -t MAM -m C:\path_to_input\mask.nii.gz -l TT -r 1 -vc 1 -o C:\path_to_output\output.csv -p C:\path_to_input\2_params_default_lattice_custom.csv

And this was the base parameter file (2_params_default_lattice_custom.csv) that extracted only intensity features:

FeatureName,ParamName,Type,Range,Default,Comments
Intensity,,,,,
Lattice,FullImage,Int,0:1,0,Whether computations across the entire image need to happen in addition to lattice
Lattice,Window,mm,0:ImageSize,6.3,Window of single lattice node
Lattice,Step,mm,0:ImageSize,6.3,Step size to increase for consecutive lattice node
Lattice,Boundary,string,[NoPadding:ZeroPadding:FluxNeumann],NoPadding,The boundary condition to use for lattice construction
Lattice,PatchBoundary,string,[Full:ROI:None],Full,Full considers all non-zero pixels and adds weight whereas ROI considers only the indeces having same value as center pixel and None disregards the patch
schakrab commented 5 years ago

Hi Sarthak,

So the maps seem to be writing now, thanks very much! So I see only 20 feature maps per image are running, but the original paper said 29. Do you know what parameters I would need to include to get the other 9?

Best, Shuvam

sarthakpati commented 5 years ago

I am not sure which features are enabled. I'd say that since the image resolutions between the paper and what you are providing are different, the results will vary.

schakrab commented 5 years ago

So I am using only the Intensity and Lattice parameters, as you mentioned. However, this only generates 20 of the feature maps, whereas the original paper said there were 29. None of the run length maps are being generated as well as things like correlation, while I see that features not listed in the original paper such as absolute deviation are being generated. Do you think the 20 that have been generated is sufficient to try to replicate the work or is there a way, by adding parameters to the file, to get exactly the features from the paper be extracted?

sarthakpati commented 5 years ago

As I mentioned in my previous comment (https://github.com/CBICA/CaPTk/issues/264#issuecomment-480856358), the parameter file was an example that just extracted intensity features. You will need to use the full 2_params_default_lattice.csv. Keep in mind the lattice window and step is defined assuming a Pixel resolution of 0.07mm but your images are 1.0mm. You should alter those to relevant numbers in order to ensure that they give scientifically valid results.