View Issue Details

IDProjectCategoryView StatusLast Update
0002990Slicer4Core: GUIpublic2017-06-07 23:27
Reporterlassoan Assigned Tojcfr  
PriorityhighSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.2.2-1 
Target VersionSlicer 4.4.0Fixed in VersionSlicer 4.4.0 
Summary0002990: Allow modules to define custom layouts
Description

A module should be able to define custom layout(s). If a custom layout is selected and the scene is saved then when the scene is loaded that custom layout should be displayed.

Unique identifier is needed for each layout. Currently the identifier is an enum, so either
A. a policy should be determined for assigning custom layout identifiers to modules
B. identifiers should be changed to strings (where conflicts can be avoided, e.g., by requiring to start the layout identifier with the module name)

A has administrative overhead and difficult to enforce, so B is preferred.

Also, it is desirable to save the description of at least the currently selected custom layout to the scene, so that the scene appears correctly even if the creator module is not available.

TagsNo tags attached.

Activities

lassoan

lassoan

2013-02-28 12:48

developer   ~0008076

From: Julien Finet [mailto:julien.finet@kitware.com]
Sent: Thursday, February 28, 2013 1:41 PM
To: Andras Lasso
Cc: Slicer Devel List; James Cook
Subject: Re: [slicer-devel] Setting View on module Load

I agree with you Andras, the layouts should be identified with a unique string. Feel free to enter a feature request (and suggest a patch :-) )
Meanwhile, you just need to pick a number odd enough (and > 100) and hope nobody else took it :-)
j.
p.s. custom layouts are highly experimentals, there would need some work needed to be able to register an icon (for the toolbar) along with the custom layout.

lassoan

lassoan

2013-02-28 12:49

developer   ~0008077

-----Original Message-----
From: slicer-devel-bounces@bwh.harvard.edu [mailto:slicer-devel-bounces@bwh.harvard.edu] On Behalf Of Steve Pieper
Sent: Thursday, February 28, 2013 4:35 PM
To: Julien Finet
Cc: slicer-devel@bwh.harvard.edu
Subject: Re: [slicer-devel] Setting View on module Load

FWIW I've been playing with a module that does dynamic layouts [1] based on what data is loaded. Right now it just has a logic class [2] that I used from other code but I hope to give it a convenient GUI at some point.

Anyway I ran into the same kind of issues with the layout ID so I ended up using 100 (since I'm redefining it all the time, I didn't see any reason for it to be a unique number).

But one downside is that when you exit the application with a non-standard view number assigned and then restart the app you get a blank screen because an unknown layout id is saved in the settings. I see two options

1) if the layout id in the settings is undefined we could go back to the Conventional layout

2) we could add the layout xml to the settings and restore the last layout.

I think 0000001 is better - any thoughts?

-Steve

lassoan

lassoan

2013-02-28 12:49

developer   ~0008078

From: slicer-devel-bounces@bwh.harvard.edu [mailto:slicer-devel-bounces@bwh.harvard.edu] On Behalf Of Julien Finet
Sent: Thursday, February 28, 2013 5:35 PM
To: Steve Pieper
Cc: slicer-devel@bwh.harvard.edu
Subject: Re: [slicer-devel] Setting View on module Load

I agree with 1), vtkMRMLLayoutNode should be a bit more robust (default to DefaultLayout instead of NoneLayout).
Concerning 2), modules should register their layouts at discovery, but if the layout at exist is a "user modified" layout (not a layout registered by the module), then the XML could still be saved in the settings.

Julien.

lassoan

lassoan

2013-02-28 12:49

developer   ~0008079

-----Original Message-----
From: slicer-devel-bounces@bwh.harvard.edu [mailto:slicer-devel-bounces@bwh.harvard.edu] On Behalf Of Andras Lasso
Sent: Thursday, February 28, 2013 5:33 PM
To: pieper@bwh.harvard.edu; 'Julien Finet'
Cc: slicer-devel@bwh.harvard.edu
Subject: Re: [slicer-devel] Setting View on module Load

1) is a simple solution, but not saving the selected layout in certain cases would be a strong limitation. We often define complete experimental setups by setting up everything in the scene then saving it. Implementing 1) would mean that we can never use custom layouts for these projects.

2) could be useful, because even if the module that defined the custom layout is not available on the Slicer instance where the scene is loaded (e.g., the corresponding extension is not installed), we could still see the correct layout.

In addition to 2) there is still needed a policy to assign reserved layout enums or switch to string IDs (to avoid undefined behavior caused by multiple modules randomly redefining the same layout).

Andras

jcfr

jcfr

2013-02-28 12:54

administrator   ~0008081

Last edited: 2013-02-28 12:55

On Thu, Feb 28, 2013 at 5:49 PM, Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> wrote:
Hi Folks,

We should really really reference layout by string. If we don't do it now, we will be scratching our head when we will actually implement it and we will have to tweak the scene reader so that older scene can be read.

Patch are welcome :)

1) If not doing so, we could reference additional layout with the following scheme .. but doing so would be like promoting what we should NOT be doing.

Layout Id would be computed using the following scheme:

SlicerLayoutUserView
SlicerLayoutUserView + Offset ModuleFooId + 1
SlicerLayoutUserView + Offset
ModuleFooId + 2
[...]
SlicerLayoutUserView + Offset ModuleBarId + 1
SlicerLayoutUserView + Offset
ModuleBarId + 2

We would then create a page on the wiki where we keep track of the moduleId.

The wiki page would list all the ModuleIds:

Foo: 0
Bar: 1
[...]

The offset could be set to 100.

2) We could also use a hash function to go from string to integer.

Hth
Jc

pieper

pieper

2013-07-05 07:34

administrator   ~0008865

Last edited: 2013-07-05 13:21

r22142 [1] helps with this. I've been using custom layouts and when I restart I was getting a blank screen. With this patch I think the situation is usable and probably no further changes are needed for my use case.

[1] http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=22142

jcfr

jcfr

2014-05-13 10:57

administrator   ~0011784

Based on Steve comment, resolving the issue.

While not "optimal", it is currently possible to create custom layour from either cpp or python.

lassoan

lassoan

2014-05-13 11:55

developer   ~0011813

I agree that the current behavior is acceptable but it should be fixed at some point. I think it's better to keep track of this issue so that when someone touches the layout implementation then this problem can be be addressed as well.

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 623f3827

2013-07-05 11:32:50

pieper

Details Diff
BUG: 0002990 use conventional layout if saved layout not available

When a module or extension creates a custom layout the number (say, 100)
is saved in the settings file and slicer tries to restore that
on the next start up. However these layouts can be transient creations
and won't be available at startup. This patch improves handling of
that case - rather than printing a warning and showing a blank screen, the
program now starts with the regular layout which leads to less
user confusion.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22142 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Widgets/qMRMLLayoutManager.cxx Diff File

Issue History

Date Modified Username Field Change
2013-02-28 12:47 lassoan New Issue
2013-02-28 12:47 lassoan Status new => assigned
2013-02-28 12:47 lassoan Assigned To => kikinis
2013-02-28 12:48 lassoan Note Added: 0008076
2013-02-28 12:49 lassoan Note Added: 0008077
2013-02-28 12:49 lassoan Note Added: 0008078
2013-02-28 12:49 lassoan Note Added: 0008079
2013-02-28 12:54 jcfr Tag Attached: I-want-to-contribute
2013-02-28 12:54 jcfr Assigned To kikinis =>
2013-02-28 12:54 jcfr Priority normal => high
2013-02-28 12:54 jcfr Target Version => Slicer 4.3.0
2013-02-28 12:54 jcfr Note Added: 0008081
2013-02-28 12:55 jcfr Note Edited: 0008081
2013-07-05 07:34 pieper Note Added: 0008865
2013-07-05 13:21 jcfr Note Edited: 0008865
2013-08-27 12:00 jcfr Target Version Slicer 4.3.0 => Slicer 4.4.0
2014-03-06 08:48 nicole Status assigned => new
2014-03-06 09:16 jcfr Severity minor => feature
2014-05-12 23:20 jcfr Tag Renamed I-want-to-contribute => help-wanted
2014-05-13 10:57 jcfr Tag Detached: help-wanted
2014-05-13 10:57 jcfr Note Added: 0011784
2014-05-13 10:57 jcfr Status new => resolved
2014-05-13 10:57 jcfr Fixed in Version => Slicer 4.4.0
2014-05-13 10:57 jcfr Resolution open => fixed
2014-05-13 10:57 jcfr Assigned To => jcfr
2014-05-13 10:57 jcfr Status resolved => closed
2014-05-13 11:55 lassoan Note Added: 0011813
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file 623f3827