Use Segment Editor Effect programmatically

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Use Segment Editor Effect programmatically

Fernando Pérez-García
Hi all,

I would like to apply a contour interpolation programmatically. I have a
SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but
wasn't able to found what I wanted. I guess I'm looking for some methods in
SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Andras Lasso-2
I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Fernando Pérez-García
Hi Andras,

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?


Fernando

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:
I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Andras Lasso-2
In reply to this post by Fernando Pérez-García

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Fernando Pérez-García
​​
​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!


2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Fernando Pérez-García
Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?


2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:
​​
​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!


2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 




_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Andras Lasso-2
In reply to this post by Fernando Pérez-García

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Fernando Pérez-García
Great, thanks again Andras.

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Csaba Pinter-2

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Steve Pieper-2
Fernando -

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

Best,
Steve

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Csaba Pinter-2
Hi Steve and Csaba,

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:
slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():
AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

I hope the code is not too messy and we can work something out together.

Best,
Fernando



2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:
Fernando -

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

Best,
Steve

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52

To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Csaba Pinter-2
In reply to this post by Csaba Pinter-2

Thanks, Fernando!

 

At the first glance, it seems the name of the class is truncated: instead of ‘vtkSlicerSegmentationsModuleLo' it should be ‘vtkSlicerSegmentationsModuleLogic’. I don’t know why this truncation happens, I assume it’s not like that in your code.

 

If you want to do batch processing, I have a sample module that may give you some ideas in general (also please let me know if you have some suggestions towards this module):

https://github.com/SlicerRt/SlicerRT/tree/master/BatchProcessing

 

csaba

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: Wednesday, February 22, 2017 07:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
Csaba,

If you check the links of my previous post, you can see that there is no
'vtkSlicerSegmentationsModuleLo' in my code and that I got the idea from
your module.

I also looked up 'vtkSlicerSegmentationsModuleLo' in the repository and
didn't find any results.

Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031720p4031834.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
This post has NOT been accepted by the mailing list yet.
In reply to this post by Csaba Pinter-2
Csaba,

If you check the links of my previous post, you can see that there is no 'vtkSlicerSegmentationsModuleLo' in my code and that I got the idea from your module.

I also looked up 'vtkSlicerSegmentationsModuleLo' in the repository and didn't find any results.

Fernando
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Andras Lasso-2
In reply to this post by Csaba Pinter-2

> I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode()

 

Probably you’ve downloaded yesterday’s build. You need revision 4.7.0-2017-02-21 r25717 or later.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 7:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

https://mailfoogae.appspot.com/t?sender=aZmVwZWdhckBnbWFpbC5jb20%3D&type=zerocontent&guid=8bd97706-0d3f-4dcb-bbe5-34d9479992d1

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Csaba Pinter-2
Andras,

I'm using r25717. As I said, the function works when called inside Slicer but not from a terminal.


Fernando

2017-02-22 15:41 GMT+01:00 Andras Lasso <[hidden email]>:

> I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode()

 

Probably you’ve downloaded yesterday’s build. You need revision 4.7.0-2017-02-21 r25717 or later.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 7:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

https://mailfoogae.appspot.com/t?sender=aZmVwZWdhckBnbWFpbC5jb20%3D&type=zerocontent&guid=8bd97706-0d3f-4dcb-bbe5-34d9479992d1

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Andras Lasso-2
In reply to this post by Csaba Pinter-2

Your script works for me without any problems: it creates nice interpolated contours. Make sure you run the correct Slicer version. Send the full application logs if you still experience problems (you can find logs of previous sessions if you start Slicer and select in menu: Help / Report a bug and then make a selection in “Recent log files” list).

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 9:43
To: Andras Lasso <[hidden email]>
Cc: Steve Pieper <[hidden email]>; Csaba Pinter <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Andras,

 

I'm using r25717. As I said, the function works when called inside Slicer but not from a terminal.

 

 

Fernando

 

2017-02-22 15:41 GMT+01:00 Andras Lasso <[hidden email]>:

> I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode()

 

Probably you’ve downloaded yesterday’s build. You need revision 4.7.0-2017-02-21 r25717 or later.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 7:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

https://mailfoogae.appspot.com/t?sender=aZmVwZWdhckBnbWFpbC5jb20%3D&type=zerocontent&guid=8bd97706-0d3f-4dcb-bbe5-34d9479992d1

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Csaba Pinter-2
My bad. My "slicer"​ alias was pointing to a previous version. It does work.

So what do you suggest we add to the repository? Frankly there are some lines in the code I don't really understand.

2017-02-22 15:48 GMT+01:00 Andras Lasso <[hidden email]>:

Your script works for me without any problems: it creates nice interpolated contours. Make sure you run the correct Slicer version. Send the full application logs if you still experience problems (you can find logs of previous sessions if you start Slicer and select in menu: Help / Report a bug and then make a selection in “Recent log files” list).

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 9:43
To: Andras Lasso <[hidden email]>
Cc: Steve Pieper <[hidden email]>; Csaba Pinter <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Andras,

 

I'm using r25717. As I said, the function works when called inside Slicer but not from a terminal.

 

 

Fernando

 

2017-02-22 15:41 GMT+01:00 Andras Lasso <[hidden email]>:

> I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode()

 

Probably you’ve downloaded yesterday’s build. You need revision 4.7.0-2017-02-21 r25717 or later.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 7:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

https://mailfoogae.appspot.com/t?sender=aZmVwZWdhckBnbWFpbC5jb20%3D&type=zerocontent&guid=8bd97706-0d3f-4dcb-bbe5-34d9479992d1

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Andras Lasso-2
In reply to this post by Csaba Pinter-2

We plan to add convenience functions that makes commonly needed features available through very simple API. Please mark in your code areas that you don’t understand or find too complex.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 9:53
To: Andras Lasso <[hidden email]>
Cc: Steve Pieper <[hidden email]>; Csaba Pinter <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

My bad. My "slicer"​ alias was pointing to a previous version. It does work.

 

So what do you suggest we add to the repository? Frankly there are some lines in the code I don't really understand.

 

2017-02-22 15:48 GMT+01:00 Andras Lasso <[hidden email]>:

Your script works for me without any problems: it creates nice interpolated contours. Make sure you run the correct Slicer version. Send the full application logs if you still experience problems (you can find logs of previous sessions if you start Slicer and select in menu: Help / Report a bug and then make a selection in “Recent log files” list).

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 9:43
To: Andras Lasso <[hidden email]>
Cc: Steve Pieper <[hidden email]>; Csaba Pinter <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Andras,

 

I'm using r25717. As I said, the function works when called inside Slicer but not from a terminal.

 

 

Fernando

 

2017-02-22 15:41 GMT+01:00 Andras Lasso <[hidden email]>:

> I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode()

 

Probably you’ve downloaded yesterday’s build. You need revision 4.7.0-2017-02-21 r25717 or later.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 7:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

https://mailfoogae.appspot.com/t?sender=aZmVwZWdhckBnbWFpbC5jb20%3D&type=zerocontent&guid=8bd97706-0d3f-4dcb-bbe5-34d9479992d1

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Use Segment Editor Effect programmatically

Fernando Pérez-García
In reply to this post by Csaba Pinter-2
May
​be I'm supposed to know some of these, but let's see:​


segmentationNode.CreateDefaultDisplayNodes()
Why do I even need display nodes in batch processing?


commonGeometryString = segmentation.DetermineCommonLabelmapGeometry( vtkSegmentationCore.vtkSegmentation.EXTENT_UNION_OF_EFFECTIVE_SEGMENTS, selectedSegmentIds) vtkSegmentationCore.vtkSegmentationConverter.DeserializeImageGeometry( commonGeometryString, mergedLabelmapGeometryImage)
I guess this is calculating the bounds of the part image with data...
        

displayNode.SetSegmentVisibility(selectedSegmentIds.GetValue(0), False)
Kind of cheating, since I knew that the first value was the ID of the old segment. Why isn't there a segment.GetSegmentID() method? Also, can't we make a list of the desired segments instead of using only the visible ones?


Fernando




2017-02-22 15:57 GMT+01:00 Andras Lasso <[hidden email]>:

We plan to add convenience functions that makes commonly needed features available through very simple API. Please mark in your code areas that you don’t understand or find too complex.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 9:53


To: Andras Lasso <[hidden email]>
Cc: Steve Pieper <[hidden email]>; Csaba Pinter <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

My bad. My "slicer"​ alias was pointing to a previous version. It does work.

 

So what do you suggest we add to the repository? Frankly there are some lines in the code I don't really understand.

 

2017-02-22 15:48 GMT+01:00 Andras Lasso <[hidden email]>:

Your script works for me without any problems: it creates nice interpolated contours. Make sure you run the correct Slicer version. Send the full application logs if you still experience problems (you can find logs of previous sessions if you start Slicer and select in menu: Help / Report a bug and then make a selection in “Recent log files” list).

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 9:43
To: Andras Lasso <[hidden email]>
Cc: Steve Pieper <[hidden email]>; Csaba Pinter <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Andras,

 

I'm using r25717. As I said, the function works when called inside Slicer but not from a terminal.

 

 

Fernando

 

2017-02-22 15:41 GMT+01:00 Andras Lasso <[hidden email]>:

> I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode()

 

Probably you’ve downloaded yesterday’s build. You need revision 4.7.0-2017-02-21 r25717 or later.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 22, 2017 7:49
To: Steve Pieper <[hidden email]>
Cc: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>


Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Hi Steve and Csaba,

 

Sure, but I think my code needs some editing before posting it to the wiki. I've made a gist so that you can check it out [1].

 

If I paste the function interpolateMergedContours() into Slicer and call it, everything seems to work. This function is supposed to take an image path as input (binary contours), interpolate it and save the result as an image and/or a mesh.

 

I want to do it automatically for a lot of images, so I'm trying to run the code in the gist (following [2]) like this:

slicer --no-main-window --python-script interpolateMergedContours.py -i /tmp/labelmapsIn/ -o /tmp/labelmapsOut/

 

But I get this error when trying to use the newly exposed ExportSegmentsToLabelmapNode():

AttributeError: 'vtkCommonCorePython.vtkSlicerSegmentationsModuleLo' object has no attribute 'ExportSegmentsToLabelmapNode'.

 

Here's a Dropbox link to a sample image with some contours: https://www.dropbox.com/s/yv9osz6jqbor6pr/4648J_RH_Lesion_merged_masks.nii.gz?dl=0

 

I hope the code is not too messy and we can work something out together.

 

Best,

Fernando

 

 

 

2017-02-22 1:20 GMT+01:00 Steve Pieper <[hidden email]>:

Fernando -

 

+1 to Csaba's suggestion.  I was starting to look at implementing some python code for the segmentation editor so anything you already sorted out would be helpful to see.

 

Best,

Steve

 

On Tue, Feb 21, 2017 at 7:11 PM, Csaba Pinter <[hidden email]> wrote:

Hi Fernando,

 

It seems to me that what you did could be useful to others. Would you consider extending the python script repository with some of the things you managed to implement here? Just the most important things in one or two snippets, mainly those that were not straightforward enough…

 

Thanks,

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: Tuesday, February 21, 2017 18:52
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: [slicer-users] Use Segment Editor Effect programmatically

 

Great, thanks again Andras.

https://mailfoogae.appspot.com/t?sender=aZmVwZWdhckBnbWFpbC5jb20%3D&type=zerocontent&guid=8bd97706-0d3f-4dcb-bbe5-34d9479992d1

 

2017-02-22 0:35 GMT+01:00 Andras Lasso <[hidden email]>:

I’ve made ExportSegmentsToLabelmapNode available from Python now. It’ll be in the next nightly build.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 21, 2017 7:48


To: Andras Lasso <[hidden email]>
Cc: SPL Slicer Users <[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Almost there! I need to export a segment to a label map using a reference volume. Is ExportSegmentsToLabelmapNode [1] exposed in Python?

 

 

2017-02-17 11:38 GMT+01:00 Fernando Pérez-García <[hidden email]>:

​​

​Great, I've managed using it reading the code for SegmentEditorAutoCompleteEffect.py [1]. Thanks again!

 

 

2017-02-16 14:54 GMT+01:00 Andras Lasso <[hidden email]>:

> Do we have access to the contour interpolation effect from Python?

 

Yes, it’s in vtkITK:

import vtkITK

interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()

 

You can use it the same way as vtkImageGrowCutSegment.

 

Andras

 

From: Fernando Pérez-García [mailto:[hidden email]]
Sent: February 16, 2017 8:40
To: Andras Lasso <
[hidden email]>
Cc: SPL Slicer Users <
[hidden email]>
Subject: Re: Use Segment Editor Effect programmatically

 

Hi Andras,

 

Thanks, that's a lot of good info. However, the only effect I see in vtkSlicerSegmentationsModuleLogic is vtkImageGrowCutSegment. Do we have access to the contour interpolation effect from Python?

 

 

Fernando

 

2017-02-07 21:49 GMT+01:00 Andras Lasso <[hidden email]>:

I've added an example to the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Andras

-----Original Message-----
From: slicer-users [mailto:[hidden email]] On Behalf Of Fernando Pérez-García
Sent: February 6, 2017 9:05
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Use Segment Editor Effect programmatically

Hi all,

I would like to apply a contour interpolation programmatically. I have a SegmentationNode and a ScalarVolumeNode that will serve as master volume.
Can you guide me through the process? I've tried digging into the code, but wasn't able to found what I wanted. I guess I'm looking for some methods in SegmentEditorAutoCompleteEffect.py.

I think this might be an interesting snippet for the script repository.

Best,
Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Use-Segment-Editor-Effect-programmatically-tp4031719.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 

 

 

 



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
12