[slicer-devel] python module wrapper

Julien Finet julien.finet at kitware.com
Tue Mar 13 10:20:48 EDT 2012


David,
If you steal(reparent) the widgetRepresentation of a module, then it won't
appear when the module becomes current. You would have to make sure to
reparent it back.
For the sake of stability, this stealing action is too dangerous and should
probably be banned.
Instead you might want to investigate the
qSlicerAbstractCoreModule::createWidgetRepresentation() method. With some
work, you might be able to clone the UI (not just reparent it).

j.

On Mon, Mar 12, 2012 at 4:31 PM, Mott, David (NIH/NCI) [C] <
david.mott at nih.gov> wrote:

> Jc,
>
> Yes i am not interested in creating a new instance of the same module.  I
> am interested in "borrowing" the module that was already created by Slicer.
>  I want to then place it within some sort of QWidget and show it as a part
> of a series of steps similar to the DWI To Full Brain Tractography and
> ChangeTracker Modules.  These have plenty of CLI that are executed but I
> dont see integration of modules as a pseudo plugin.
>
> In your example, will simply placing the "widgetRepresentation" into a
> QWidget that is within the module UI be all I need?
>
> David Mott(Contractor)
> Bioinformatics Analyst II
> SAIC-Frederick, Inc.
> National Cancer Institute of Frederick
> P.O. Box B
> Frederick, MD  21702
> Phone:  301-846-5856
> Fax: 301-846-5762
> mottdm at mail.nih.gov
> ________________________________________
> From: Jean-Christophe Fillion-Robin [jchris.fillionr at kitware.com]
> Sent: Monday, March 12, 2012 4:05 PM
> To: Mott, David (NIH/NCI) [C]
> Cc: slicer-devel at bwh.harvard.edu
> Subject: Re: [slicer-devel] python module wrapper
>
> Hi David,
>
> Modules available under the "slicer.modules" namespace correspond to THE
> instance of the module. As of today, there is only one instance of each
> module and it's not possible to create a new instance of a module
> representation from within python. (It should be possible to wrap the
> module representation of each module without too much effort)
>
> The screenshot "Embed-existing-instance-of-module-widget.png" illustrates
> how an existing module representation can be embedded in any given widget.
> Within the regular Slicer application, this example shouldn't be followed,
> doing so .. the user wouldn't be able to see the widget associated with the
> camera module if he selects it using the module menu.
>
> If you provide me with additional details, may be a code snippet on
> https://gist.github.com/ or on your github account, I would be happy to
> provide more guidance.
>
> Hth
> Jc
>
> On Mon, Mar 12, 2012 at 3:21 PM, Mott, David (NIH/NCI) [C] <
> david.mott at nih.gov<mailto:david.mott at nih.gov>> wrote:
> Slicer Team,
>
> I am setting up a Slicer python script that allows me to pull in a module
> and show that within a python wrapper script.  What would be the best way
> to do this?
>
> I am aware of the getModule and getModuleGui.  Is it as simple as placing
> the Gui within a QWidget once I am able to pull it?
>
> thanks
>
>
>
> David Mott(Contractor)
> Bioinformatics Analyst II
> SAIC-Frederick, Inc.
> National Cancer Institute of Frederick
> P.O. Box B
> Frederick, MD  21702
> Phone:  301-846-5856<tel:301-846-5856>
> Fax: 301-846-5762<tel:301-846-5762>
> mottdm at mail.nih.gov<mailto:mottdm at mail.nih.gov>
> _______________________________________________
> slicer-devel mailing list
> slicer-devel at bwh.harvard.edu<mailto:slicer-devel at bwh.harvard.edu>
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
> To unsubscribe: send email to
> slicer-devel-request at massmail.spl.harvard.edu<mailto:
> slicer-devel-request at massmail.spl.harvard.edu> with unsubscribe as the
> subject
>
>
>
> --
> +1 919 869 8849
>
> _______________________________________________
> slicer-devel mailing list
> slicer-devel at bwh.harvard.edu
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
> To unsubscribe: send email to
> slicer-devel-request at massmail.spl.harvard.edu with unsubscribe as the
> subject
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://massmail.spl.harvard.edu/public-archives/slicer-devel/attachments/20120313/13fd8189/attachment.html 


More information about the slicer-devel mailing list