Run script when SlicerCAT first time launched

Hi,

I need to do some customizations when user first time launches SlicerCAT.
Is there a way to achieve that?

More detailly:
I bundle julia with SlicerCAT.
I install some packages to julia during buildtime but these packages hardly transportable. Julia is organized differently than python.

And the main reason is that during buildtime I install pyjulia to python and I set the path to the julia during that action.
After packaging SlicerCAT the path to julia changes so I need to reinstall/update pyjulia.

You can do anything anytime, not just at the first launch. If you want to do something only once then you can detect if you have already performed the action that you want to do only once and don’t do it again.

I’m just curious. What do you intend to do with Julia that Python and C++ does not cover well enough already?

1 Like

Thank you,

I think I will try to use some environment variable in SlicerCAT’s setting.

For now I find JUDI library very attractive.
Though it uses python’s Devito under the hood for solving wave equation.
It is all about wavefield modeling and wavefield inversion (restore velocity model from wavefield).
It is tested on big data (I don’t remember 1.6 TB or 16 TB) and that is very important.
And it is open source under MIT license.

By the way there is some medical example maybe you will find it useful.

I very like julia as it has pretty simple syntax similar to Matlab and it is all about math. It has great interability with python. I can write python module in SlicerCAT and use easilly call julia code. I even can do some GUI staff by calling python from julia (and python calls PythonQt).

I believe in the future its popularity will grow.

This is what I (and most other software developers) dislike about it.

Just one example. For me, choice of 1-based indexing disqualifies the language from any further consideration. It means that its developers don’t think like programmers, so I would need to throw away lots of my prior experience and intuition in software development and would need to relearn whatever julia developers thought could be good ideas.

It seems that its popularity has plateaued about 4 years ago (TIOBE Index - TIOBE). I don’t see the language has space to grow when we have Python for flexible high-level glue code and C++ for developing low-level high-performance algorithm code.

I started “programming” with Matlab. Probably that why I like julia.

If you mean the only example of a library (JUDI), then I can say there is no alternatives in open source software. There are libraries for wave modeling and inversion but they hardly work with big data.
Writing something similar by myself would take half of my life at least. And even then I won’t do that.

Don’t understand why so critical to 1 based indexing.

Alright it is inconvenient to code in julia and C/C++/python at the same time. But after a while you get used to that.
Also sometimes you have an array of indexes generated in julia (starts with 1) and you need to pass it to python (start with 0) to retrieve for example columns from array. In that case you also need to keep in mind that most likely you would like to subtract 1 before passing it to python.
But to run julia code from python application you usually need to get some parameters (from GUI for example) and pass it to julia for heavy weight computations. That is it. After that julia algorithm starts to work and you get only the result of computations. Save it to file or plot it.

I have not seen the statistics.
But as for me as I started with Matlab what I didn’t like the most is that it is very heavy and standalone. There is no cooperation with python. Julia solves this. I think julia is some kind of a pythonical version of Matlab.

Some little thing that I also don’t like in python is that numpy arrays are row-oriented by default (i’m talking about memory layout). In Matlab and julia and C++ Eigen arrays are column oriented by default. For me it is sligtly better to work with column oriented arrays.

I disagree.
Let’s imagine an engineer who has some math knowledge and have a task to write high perfomance algorithm.

For me it was very difficult to get started with C++. I didn’t know anything about compilation, ABI, the errors that I get, how to link libs etc… Don’t know why I didn’t throw this idea away.
It is very likely that the engineer doesn’t know C/C++. And if he needs parallelization (MPI?), would he choose to write an algorithm in C++? I don’t think so.

Most likely he will choose either python or julia.
And there the chances for choosing python/julia are somehow equal I think. Python is fullly functional but avoid loops and julia is narrowly focused math language.

And one more thing that I lately got known with. It is about interfaces and types.
If you use some external library and it has some function:

export foo

function foo(Int x, Int y)
  x + y
end

Then you usually can overload (or override) it:

import foo

function foo(Float x, Float y)
  x + y
end

It is the simplest example but if foo works with custom struct then it make more sense as you can make the external library work with your struct type.

I don’t know if this is possible in python but this may greately help when adjusting external library for your custom data.

I meant one-based indexing is just one example of why I don’t consider getting to know Julia better.

Indexing is important because developers of the language decided to break with a well-established norm of today’s programming languages.

I agree. Octave a Julia are strong Matlab competitors. Julia has a more friendly license, which is good; but does not exactly follow Matlab syntax and API, which might make switch from Matlab a bit harder.

However, Matlab+Octave+Julia combined represent only a very small fraction of programming languages and their share may continue to shrink, as engineering schools may slowly move to Python from Matlab as scope and quality of engineering modules in Python improve.

I see now.

And if some of these three will survive then I would bet that it most likely will be julia :slight_smile:

It very well may be.

By the way, I am the author of MatlabBridge extension (wrote it before Python was a thing and I still used Matlab occasionally). Similarly, you could write a JuliaBridge extension that makes it easier to use Julia from Slicer. Even just minor configuration things, installing required Python packages, updating paths, etc. could help. I would be happy to suggest users to try JupyterBridge instead of MatlabBridge when they come to me with questions.

1 Like

I remember we had some conversation on that I keep that in mind.

My project is enthusiastic and soon (probably a 1-2 months) the future of my project will be decided.
For now I’m trying to some kind of a finilize my work to present it and if everything is ok I hope I get sponsorship.

2 Likes