GithubHelp home page GithubHelp logo

Comments (33)

Edouard2laire avatar Edouard2laire commented on July 29, 2024 1

Screenshot from 2021-09-06 18-49-20
it start to look nice :)

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Thanks a lot for the report. I will have a look at this issue next week. I might need your help though to decide which solution to use, I am going to write a more detailed response to detail why we are calling such a slow function here.

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hello @ftadel,

Sorry for the very long delay. I have no idea how to remove this dependency. So the main ideas of these process are to generate the nirs montage; therefore there is no input to the process; however, in order to define the montage, the user needs to select the scout that they want to target.

See picture for exemple. (you can see how the different surface are used here: https://github.com/Nirstorm/nirstorm/blob/master/bst_plugin/OM/process_nst_OM_from_head.m#L146)

Screenshot from 2021-05-17 14-04-20

One the option i think would be:
-> Create a gui to call the process by right clicking on the cortical surface and then generate OM from cortex in this case; but i don't know how to do it; and it would need to have it integreted directly in brainstorm code which break the independency between brainstorm and nirstorm.

-> have a button in the process that then create a gui to select the ROI (again, i am not sure how to doi it). The advantage would be that this code is only executed when the user is executing the process.

Or would you have a better option ofr me ?

Edouard

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Wow, I didn't realize that this issue was not fixed yet and that it was loading ALL the cortex surfaces 4x at startup...
This is insane, with hundreds of subjects, it would take hours to start Brainstorm.
If it were only for your users, the scope of the problem would be limited, but since Nirstorm is now part of the compiled distribution of Brainstorm, all the users of the compiled distribution of Brainstorm are now suffering from it.
This has to disappear ASAP, please. And I'll have to recompile Brainstorm immediately after.

If you need to do extra stuff when setting the options, use the option type editpref together with a custom options panel panel_nirstorm or panel_nirstorm_scouts, or anything panel_nst_options (anything that can't overlap with Brainstorm or other plugins).

A simple example is available in process_fem_tensor.m / panel_femcond.m.
To add drop-down menus, example code in panel_process_select.m, line 1064 (combobox).

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

And when you load the surfaces, at least read only the Atlas field, instead of the entire file...

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Wow, I didn't realize that this issue was not fixed yet and that it was loading ALL the cortex surfaces 4x at startup...
This is insane, with hundreds of subjects, it would take hours to start Brainstorm.
If it were only for your users, the scope of the problem would be limited, but since Nirstorm is now part of the compiled distribution of Brainstorm, all the users of the compiled distribution of Brainstorm are now suffering from it.
This has to disappear ASAP, please. And I'll have to recompile Brainstorm immediately after.

If you need to do extra stuff when setting the options, use the option type editpref together with a custom options panel panel_nirstorm or panel_nirstorm_scouts, or anything panel_nst_options (anything that can't overlap with Brainstorm or other plugins).

A simple example is available in process_fem_tensor.m / panel_femcond.m.
To add drop-down menus, example code in panel_process_select.m, line 1064 (combobox).

yes; it's a historical debt we got at the beginning of Nirstorm, and we never really had time to fix it... I'll look at the code you mentioned and will let you know if I make any progress. Currently, I am very busy with writing my QBIN scholarship application; so it might take few weeks.

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Then I will recompile Brainstorm without Nirstorm in the meantime.
Let me know when you want it to be integrated again in the compiled distribution.

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

brainstorm-tools/brainstorm3@63d470c

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Actually those process cannot be executed in the compiled version as they required respectively either Cplex (for optimal montage) or Mcxlab (for fluence). So the better option would be remove t’ajuste those process

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Actually those process cannot be executed in the compiled version as they required respectively either Cplex (for optimal montage) or Mcxlab (for fluence). So the better option would be remove t’ajuste those process

If you want to have two versions of the plugin, one including the functions that work in compiled mode only, and one with all the functions, please set this up as two different packages to download, and/or two different repositories.

This will not solve the initial issue, which is that with tens (or hundreds) of subjects, the current process definition would make Brainstorm impossible to start, even not in compiled mode. This needs to be fixed, regardless of this other problem.

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

This will not solve the initial issue, which is that with tens (or hundreds) of subjects, the current process definition would make Brainstorm impossible to start, even not in compiled mode. This needs to be fixed, regardless of this other problem.

i totally agree. But again; i am not the one who designed those process so badly... and i am already struggling with my own work for my phd... so once i find some time, i'll do it.

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hello Francois,

I started working on that issue but i was wondering if you could help me with GUI details. I am trying to get something like this:
scout_selection

Right now, I have (https://github.com/Edouard2laire/nirstorm/tree/OM_1):
scout_selection2

I therefore have two questions:
-> How do i know when the user change the selection from the list ? I tried to add a callback, but it doesn't seems to be called like for the button.

-> What would be the best way to show the different scout associated to the selected atlas ?

Regards,
Edouard

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

I am trying to get something like this:

I'm not sure I follow exactly what you're trying to do.
Do you want to have a list of process options, or an independent panel that is called from an option editpref in the process?
In the second case, you need to write a lot more code, and define all the interactivity of all the components manually.

How do i know when the user change the selection from the list ? I tried to add a callback, but it doesn't seems to be called like for the button.

You can attach a callback function ItemStateChangedCallback to a drop-down combobox directly from the call to gui_component:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/gui/gui_component.m#L124

Or you can it manually with java_setcb, as it is done for the option types scout and scout_confirm in the pipeline editor:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/panel_process_select.m#L1197

What would be the best way to show the different scout associated to the selected atlas ?

Using the pipeline editor option directly instead of a separate panel.
Or copy-paste code from the option type scout in panel_process_select.

Does it help?

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Do you want to have a list of process options, or an independent panel that is called from an option editpref in the process?
In the second case, you need to write a lot more code, and define all the interactivity of all the components manually.

Unfortunately, as the process is not using any file as input, we cannot use the process options, and we need a separate panel. By the way, in this case, is it better to put all the options in the separate pannel or have a mix of some options in the process pannel and some in the additional pannel?

Using the pipeline editor option directly instead of a separate panel.Or copy-paste code from the option type scout in panel_process_select.

Thx; i'll have a look

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

progress

Making some progress; now i only needs to define the proper callbacks :)

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hello @ftadel

I was wondering, how can i recover the options selected in the panel from the process function?

I am curently doiing '''sProcess.options.fluencesCond.Comment = {'panel_nst_fluences', 'Scout: '};
sProcess.options.fluencesCond.Type = 'editpref';''' like in process_fem_tensors however, if i try to do
OPTIONS = sProcess.options.fluencesCond.Value; like in process_fem_tensors i can't recover the user input.

Edit: i was having a typo in the name of the function GetPanelContents; it's working now :)

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

is it better to put all the options in the separate pannel or have a mix of some options in the process pannel and some in the additional pannel?

I'd tend to put as many things as possible in the process options, as it does not require any additional coding.
Both can make sense, do as you think it looks more natural for your users.

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hi Francois,

I have been to make the process work when using a cortical scout. However, i am struggling to put all the options in the panel. When i try to add a new input after the scout selection, the order is not respected
bug_GUI

Additionally, i tried to duplicate the code for the scout selection to be able to see the scout define on the head and on the cortex; but they get mixed together
weird

Note: The file can be found here: https://github.com/Edouard2laire/nirstorm/blob/OM_1/bst_plugin/forward/panel_nst_fluences.m

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

It looks like you need to learn a bit about Java/Swing layouts for being able to do what you want...
For this purpose, you should probably try using a GridBagLayout or a BoxLayout, instead of a RiverLayout.

Maybe read a tutorial about layouts and then search for the Brainstorm code for examples of one or the other.

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

ok. I'll have a look this weekend; however i am not sure i can spend too much time in learning Java/swing

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

GridBadLayouts are not so complicated, but they require some organization...
It's a matrix of cells, like an excel spreadsheet. For each component you want to add to the interface, you define the location of the cell you want it to be in (gridx, gridy), what width (or height) it has relative to the total width (or height) of all the cells (weightx, weighty), and how it should be fill the cell (GridBagConstraints.HORIZONTAL, GridBagConstraints.VERTICAL or GridBagConstraints.BOTH).
If you set a width (or height) to 0, it uses the minimum size of the component (set with .setMinimumSize, or defined automatically based on the contents of the component).

Example:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/gui/panel_search_database.m#L54

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Screenshot from 2021-06-26 17-52-38

Java is so hard...

edit: Making some progress
Screenshot from 2021-06-26 18-06-31

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Sorry for the response delay, I'm traveling a lot at the moment...

Do you still need help with this?
I can help you may it look like what you want: describe precisely how it is like at the moment and how you'd like it to be, and I'll try to make this happen.

Did you manage to make the panel work the way you wanted, in terms of options selection?

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hello;

Did you manage to make the panel work the way you wanted, in terms of options selection?

Right now, the combination of the panel to select the scout and the process for the other options is working. I have been using it for the past few weeks and it so much better. I think the update of the fluences and Optimal montage will be a great update for Nrstorm (so thanks for pushing us into that direction :) )

Here is a sketch of what I would like the panel to looks like:

Image

Right now, it looks like this:

Capture d’écran 2021-07-10 à 13 47 40
Capture d’écran 2021-07-10 à 13 47 58

My main struggle is to move the options from the process panel to the new pane (also, you can see that on my mac there is some overlapping between texts)

The left part is done, but I am struggling with the right part. It should contain 4 blocks.

  1. The reference to MCXlab article
  2. the Forward Model options:
  • Segmentation file: Droplist to select which segmentation to use
  • Segmentation label: button to select how is segmented the MRI (1 corresponding to skin or WM); can be automatically selected if the segmentation file contains the label information. (note: I have old segmentations file in my DB where this information is not present)
  • Wavelength: text box ( typical content '685, 830')
  1. Simulation options
  • Number of photons (millions): textbox ( typically between 20 and 200)

  • GPUID: this option is here to select which GPU use to compute the simulation. We have two options:
    either, like currently a text box where user can enter "1,2" to use GPU 1 and 2; or have the list of the available GPU to select (the info about the about the vaialbles GPU can be obtained using info=mcxlab('gpuinfo') returning a list where info(i).name is the name of the GPU i)

  • Use default optical properties: Checkbox. (For now, we only support default; so should always be checked). To be able to support the other options, we should have copy the Media setting panel from MXC studio (http://mcx.space/wiki/upload/mcxstudio_windows.png) to specify the value of mua; mus; g, and n for each tissue and each wavelength. Might not be necessary for now.

  1. Output
  • Output folder : folder selection
  • Set threshold for fluences (reduce file size) : checkbox
  • Threshold for fluences : value (1e-6(1/mm2/s))
  • Overwrite Fluences : checkbox

Regards,
Edouard

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

also, you can see that on my mac there is some overlapping between texts

Most likely because you are not forcing the size of the objects somewhere, instead of letting the size of the window drive the whole thing.

Here is a sketch of what I would like the panel to looks like:

Have you checked existing examples?
It looks a lot like the panel you get with the menu "Import MEG/EEG", defined in panel_import_data.m:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/gui/panel_import_data.m

The main parent panel has a BorderLayout, the left side in BorderLayout.EAST (not adjusting with the window size, based on MinimumSize or PreferredSize - not sure), the right is BorderLayout.CENTER (size adjusted when resizing the window, default size based on PreferredSize).
In this file, both left and right panels are RiverLayouts, but could be written with BoxLayout (Vertical) or GridBagLayout.

image

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Java interfaces are not easy to assemble programmatically, I understand the pain you're going through...
If you're really stuck and need help, post your code somewhere (a separate PR?) so I can have a look at it.

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hi;
Indeed, a little bit of help would be very welcome :) However, i am not sure about what you mean by a separate PR ? This one (#170) is not good ?

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Indeed, I can get everything from there.

I'll push a commit for you to get this panel:
image

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Oops, I can't push the code there.
Here are my updates:
panel_nst_fluences.zip

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Thanks a lot ! I'll try to have a look assap :)

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Will push the change of #170 today.
Screenshot from 2021-09-20 13-18-39

from nirstorm.

Edouard2laire avatar Edouard2laire commented on July 29, 2024

Hello @ftadel,

I made the change asked, so I am closing the issue :)

from nirstorm.

ftadel avatar ftadel commented on July 29, 2024

Looks great!

I restored the compilation of the nirstorm plugin in the compiled distriubtion of Brainstorm:
brainstorm-tools/brainstorm3@0428eb6

Could you try running the last compiled version of Brainstorm and make sure all the nirstorm basic functions and your recent changes work correctly?

Thanks

from nirstorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.