sbonaretti / pyKNEEr

An image analysis workflow for open and reproducible research on femoral knee cartilage
https://sbonaretti.github.io/pyKNEEr/
GNU General Public License v3.0
32 stars 11 forks source link

Run preprocessing on my DICOM Data #10

Open ZemaTimoteo opened 3 years ago

ZemaTimoteo commented 3 years ago

Hi @sbonaretti ,

My name is Tiago and I am using pykneer for getting T2mapping.

I convert the preprocessing.ipynb into a python file, and it runs the DEMO data. However I can not make it run on my Dicom data. I get this error code when uploading dicom images for preprocessing:

itkTemplate.TemplateTypeError: itk.Image is not wrapped for input type `itk.UC, int`.
To limit the size of the package, only a limited number of
types are available in ITK Python. To print the supported
types, run the following command in your python environment:
    itk.Image.GetTypes()
Possible solutions:
* If you are an application user:
** Convert your input image into a supported format (see below).
** Contact developer to report the issue.
* If you are an application developer, force input images to be
loaded in a supported pixel type.
    e.g.: instance = itk.Image[itk.RGBPixel[itk.UC], int].New(my_input)
* (Advanced) If you are an application developer, build ITK Python yourself and
turned to `ON` the corresponding CMake option to wrap the pixel type or image
dimension you need. When configuring ITK with CMake, you can set
`ITK_WRAP_${type}` (replace ${type} with appropriate pixel type such as
`double`). If you need to support images with 4 or 5 dimensions, you can add
these dimensions to the list of dimensions in the CMake variable
`ITK_WRAP_IMAGE_DIMS`.
Supported input types:
itk.RGBPixel[itk.UC]
itk.RGBAPixel[itk.UC]
itk.Vector[itk.F,2]
itk.Vector[itk.F,3]
itk.Vector[itk.F,4]
itk.CovariantVector[itk.F,2]
itk.CovariantVector[itk.F,3]
itk.CovariantVector[itk.F,4]
itk.SS
itk.UC
itk.US
itk.F
itk.complex[itk.F]
itk.Vector[itk.D,2]
itk.Vector[itk.D,3]
itk.Vector[itk.D,4]
itk.D
itk.UL
itk.ULL
itk.B
itk.FixedArray[itk.F,2]
itk.Offset[2]
itk.SymmetricSecondRankTensor[itk.D,2]
itk.RGBPixel[itk.UC]
itk.RGBAPixel[itk.UC]
itk.Vector[itk.F,2]
itk.Vector[itk.F,3]
itk.Vector[itk.F,4]
itk.CovariantVector[itk.F,2]
itk.CovariantVector[itk.F,3]
itk.CovariantVector[itk.F,4]
itk.SS
itk.UC
itk.US
itk.F
itk.complex[itk.F]
itk.Vector[itk.D,2]
itk.Vector[itk.D,3]
itk.Vector[itk.D,4]
itk.D
itk.UL
itk.ULL
itk.B
itk.FixedArray[itk.F,3]
itk.Offset[3]
itk.SymmetricSecondRankTensor[itk.D,3]
itk.Vector[itk.F,1]
itk.Vector[itk.D,2]
itk.Vector[itk.D,3]
itk.Vector[itk.D,4]
itk.Vector[itk.F,1]
itk.CovariantVector[itk.D,2]
itk.CovariantVector[itk.D,3]
itk.CovariantVector[itk.D,4]
itk.CovariantVector[itk.D,2]
itk.CovariantVector[itk.D,3]
itk.CovariantVector[itk.D,4]
itk.NormalBandNode[itk.Image[itk.F,2]]
itk.NormalBandNode[itk.Image[itk.F,3]]

This issue occurs on line 117 of sitk_functions.py I attatched '.txt' files for the DEMO data and MyData of img_sitk variable configurations (Apperently they seem alike.)

DEMO_img_sitk.txt MyData_img_sitk.txt

Code pK_preprocessing.py: Code.txt

I don't know what I should do to get around this issue. Your help would be very helpful.

Thank you so much in advance.

Best Tiago

sbonaretti commented 3 years ago

Hi Thiago, Thanks a lot for your interest in pyKNEEr! It seems to be an issue with your dicom data type. One quick test would be to resave your dicom images using a software written in ITK and then see if it works. Would that make sense to you? If so, one option is to use ITK-SNAP (see here). Open one dicom stack in ITK-SNAP and resave it as a dicom (changing name or in another folder so you do not overwrite your original dataset). Then try to use this newly saved dicom in the preprocessing notebook, and see if it works. Let me know!

ZemaTimoteo commented 3 years ago

Hi @sbonaretti ,

Thank you for such a quick reply! I try to do as you said, however it did not run. The ITK-SNAP did not seam to have an option to save it as DICOM, so I used the Generic ITK image (Should I do differently)?

test1

What other way do I have to check if the DICOMfiles are well suited to run with pyKNEEr?

Thank you so much in advance Tiago

sbonaretti commented 3 years ago

Hi, Yes, you are right, I have just double checked as well. As soon as I have time, I will add the possibility of starting the pipeline with images other than .dcm. Have you tried with other software, e.g. Horos? Sorry for not being able to help you more right now. Best, Serena