Giter VIP home page Giter VIP logo

Comments (2)

Fiy-fly avatar Fiy-fly commented on August 16, 2024

Sorry,I already know how to save in NII format, but I'd still like to know how to see the raw segments in the MATLAB workspace

from pulmonarytoolkit.

tomdoel avatar tomdoel commented on August 16, 2024

Here are two ways:

  1. Using the GUI, you can "Export Segmentation" and choose "Format: Matlab". This should save the segmentation matrix as a Matlab .mat file, which you can load into the workspace. The segmentation matrix is of datatype uint8, where 0 means no segmented region, and other values mean part of a segmentation, where the values used depend on the type of segmentation. For example, for lung segmentations, 1 is Right and 2 is Left.

  2. You can write a script which uses the API (see Tutorial 3 for an introduction) and fetch the result of the corresponding segmentation plugin using dataset.GetResult(). The result will usualy be a PTKImage object, whose property RawImage is the Matlab matrix containing the segmentation values (same as above). NB be aware the segmentation image you get will be cropped to the lung region of interest by default - if you don't want this and want a full size image, then you would do this by adding an additional "context" argument set to PTKOriginalImage to the GetResult() call. For example dataset.GetResult('PTKLeftAndRightLungs', 'PTKOriginalImage');

Here is a rough example script for fetching lung and lobe segmentations using the API (Note I have not tested this!)

PTKAddPaths;
ptk_main = PTKMain();
uid = `PUT_THE_UID_FOR_YOUR_DATASET_HERE`;
dataset = ptk_main.CreateDatasetFromUid(uid);

lung_segmentation = dataset.GetResult('PTKLeftAndRightLungs');
% Now lung_segmentation.RawImage contains the lung segmentation matrix

lobe_segmentation = dataset.GetResult('PTKLobes');
% Now lobe_segmentation.RawImage contains the lobe segmentation matrix

from pulmonarytoolkit.

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.