frankkramer-lab / MIScnn

A framework for Medical Image Segmentation with Convolutional Neural Networks and Deep Learning
GNU General Public License v3.0
400 stars 116 forks source link

Update save_prediction in nifti interface to open with the software application #73

Closed JimHeo closed 3 years ago

JimHeo commented 3 years ago

With the issue #64, the software applications such as 3D Slicer or ITK-SNAP can't read the prediction data in this repo. Including KiTS19, actually, the type of NIFTI format target data consists of type of <class 'numpy.uint16'>. So, we need to cast the pred in save_prediction function of nifti_io.py as np.uint16. And also, Affine matrix for spacing is necessary, too. Therefore, I update the code of the function.

Cheers, Jim

codecov-io commented 3 years ago

Codecov Report

Merging #73 (a4f86d7) into master (278dd21) will decrease coverage by 0.04%. The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
- Coverage   91.39%   91.34%   -0.05%     
==========================================
  Files          52       52              
  Lines        3718     3721       +3     
==========================================
+ Hits         3398     3399       +1     
- Misses        320      322       +2     
Impacted Files Coverage Δ
miscnn/data_loading/interfaces/nifti_io.py 84.28% <60.00%> (-2.29%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 278dd21...a4f86d7. Read the comment docs.

JimHeo commented 3 years ago

Hi, @muellerdo.

I just checked master branch. I followed up the dev branch few minutes ago, then I think probably the code in 9571103 could be worked for the affine spacing. In that, would you merge the code to master from dev branch?

However, except for that part, one of the point on this issue with the #64 is the mismatch of the data type. In the code, the elements of pred numpy is the int type. But, the type must be unsigned int to display on the software application such as ITK-SNAP or 3D Slicer. So, we need to cast to np.uint16 from np.int64.

btw, I'm glad to contribute to your repo. Cheers, Jim

muellerdo commented 3 years ago

Hey @JimHeo,

I followed up the dev branch few minutes ago, then I think probably the code in 9571103 could be worked for the affine spacing. In that, would you merge the code to master from dev branch?

Done.

However, except for that part, one of the point on this issue with the #64 is the mismatch of the data type. In the code, the elements of pred numpy is the int type. But, the type must be unsigned int to display on the software application such as ITK-SNAP or 3D Slicer. So, we need to cast to np.uint16 from np.int64.

Implemented in 998d6f5392e50f8b9285cd09b2d8b25de9e8ca3d of the current dev branch.

Thanks for your contribution & pointing this issue out again!

Going to merge it to the master branch/pypi soon.

Cheers, Dominik

muellerdo commented 3 years ago

Merged into master and pypi version 1.1.8 published.