Re: Loading MRML Nodes and pass to an add on python modules that uses slicer from cmd line

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

Re: Loading MRML Nodes and pass to an add on python modules that uses slicer from cmd line

pieper
Administrator
Hi Deepika -

There is are --execpython (runs command after gui starts) and
--evalpython (runs command instead of starting gui) command line
arguments but I've never tried to use them to run a module.  It may not
be ideal but it's worth trying.

In theory there would be a way to essentially 'import slicer' and get
all the needed commands in the interpreter so you could run the module.
  But this hasn't ever been set up, I don't think.

Demian has similar goals, so he may have some suggestions.

-Steve



On Jun/17/10 11:21 AM, [hidden email] wrote:

> Hi Steve,
>
> I am Deepika, a student of Martin Styner's at UNC. I have a python
> module that can be added to Slicer(i.e. not in-built in Slicer) and uses
> MRML nodes(DWI volumes and labelmaps) loaded into Slicer as input. I'd
> like to know if there is a way I can do the loading and execution of the
> module from command line (without having to open Slicer explicitly) and
> if so how.I don't want to modify the existing code but can write a
> wrapper if needed.
>
> I have posted this on the Slicer users and developers mailing lists too,
> so sorry if I am flooding your inbox.
>
> Thanks,
> Deepika
>
>
>
>
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Loading MRML Nodes and pass to an add on python modules that uses slicer from cmd line

pieper
Administrator
Hi Deepika -

It's a little bit long to put on the command line, but if you write a
wrapper script it should be okay - you can do something like this:

> ./Slicer3 --execpython "import Slicer; Slicer.slicer.Application.GetModuleGUIByName('Volumes').GetLogic().AddArchetypeVolume('/tmp/volumeFile.nrrd', 'volumeName')"


Pretty much the full API is accessible from python:

http://www.na-mic.org/Slicer/Documentation/Slicer3-doc/html/classes.html

Best,
Steve


On Jun/17/10 2:14 PM, [hidden email] wrote:

> How do I add nrrd files into MRML nodes from cmd line? Right now, if I
> use --execpython, Slicer gui starts, loads files that I have provided as
> arguments into MRML nodes but doesn't start execution by itself.
>
> Are there some documents/man pages where I can find the attributes of
> MRML Node/Scene - that can be used in python code?
>
> -Deepika
>
> Quoting Steve Pieper <[hidden email]>:
>
>> Hi Deepika -
>>
>> There is are --execpython (runs command after gui starts) and
>> --evalpython (runs command instead of starting gui) command line
>> arguments but I've never tried to use them to run a module. It may not
>> be ideal but it's worth trying.
>>
>> In theory there would be a way to essentially 'import slicer' and get
>> all the needed commands in the interpreter so you could run the
>> module. But this hasn't ever been set up, I don't think.
>>
>> Demian has similar goals, so he may have some suggestions.
>>
>> -Steve
>>
>>
>>
>> On Jun/17/10 11:21 AM, [hidden email] wrote:
>>> Hi Steve,
>>>
>>> I am Deepika, a student of Martin Styner's at UNC. I have a python
>>> module that can be added to Slicer(i.e. not in-built in Slicer) and uses
>>> MRML nodes(DWI volumes and labelmaps) loaded into Slicer as input. I'd
>>> like to know if there is a way I can do the loading and execution of the
>>> module from command line (without having to open Slicer explicitly) and
>>> if so how.I don't want to modify the existing code but can write a
>>> wrapper if needed.
>>>
>>> I have posted this on the Slicer users and developers mailing lists too,
>>> so sorry if I am flooding your inbox.
>>>
>>> Thanks,
>>> Deepika
>>>
>>>
>>>
>>>
>>
>>
>
>
_______________________________________________
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