Giter Club home page Giter Club logo

Comments (7)

cshwhale avatar cshwhale commented on August 10, 2024 1

@Eurus-Holmes
@pervinh
Hi, I save the predicted mask as nii format and then visualize it with ITK-SNAP software. The code is as follows:
import nibabel
vis_data = nibabel.Nifti1Image(np.array(mask).astype(np.float32), np.eye(4))
nibabel.save(vis_data, "mask_vis.nii.gz")

from medicalnet.

cshwhale avatar cshwhale commented on August 10, 2024

We visualized the segmentation results by ITK-SNAP software.

from medicalnet.

Eurus-Holmes avatar Eurus-Holmes commented on August 10, 2024

oh, I see, but in your code test.py, it seems you don't save the predicted mask images?

from medicalnet.

pervinh avatar pervinh commented on August 10, 2024

Hi, I have the same problem too. How can i save segmentation results as nifti files?

from medicalnet.

pervinh avatar pervinh commented on August 10, 2024

@cshwhale
Thank you, this worked

from medicalnet.

Eurus-Holmes avatar Eurus-Holmes commented on August 10, 2024

@cshwhale Thanks!

from medicalnet.

ni-wei avatar ni-wei commented on August 10, 2024

@Eurus-Holmes
@pervinh
Hi, I save the predicted mask as nii format and then visualize it with ITK-SNAP software. The code is as follows:
import nibabel
vis_data = nibabel.Nifti1Image(np.array(mask).astype(np.float32), np.eye(4))
nibabel.save(vis_data, "mask_vis.nii.gz")

Hi,

in order to register the predicted mask with the data & label, does it make sense to obtain a "target_affine" from the data, and replace the "np.eye(4)" in SH's code with this "target_affine"?
I obtained the "target_affine" by inserting the following 2 lines next to https://github.com/Tencent/MedicalNet/blob/25ba32573f281646f8a3d15f096d017de615ee3a/test.py#L62
data = nib.load(os.path.join(sets.data_root, img_names[batch_id]))
target_affine = data.affine

Thanks,
Wei

from medicalnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.