`get_view` und transformed sources
Closed this issue · 7 comments
Hi,
I have a convoluted view where I have specific imageDisplay
sets for differently transformed versions of a single source (through sourceNamesAfterTransform
). Something like shifting a single source multiple times while gradually reducing opacity and still displaying all of these derived sources in a single view.
I think this scenario should be possible (different displays for different sourceNamesAfterTransform
from one source).
It seems get_view
needs all sources to be specified in the parameters
so I run into an error here.
Is there a way to create such a view in mobie-python
, or do I need to hack it into the JSON manually?
The code that I like to implement this into is here:
Can you write a simplified example for one of these views? (I.e. writing how it would look in json with just a few sources).
That would help to understand what you want to do.
One comment regarding the check in
This may indeed currently clash with the sourceNamesAfterTransform
logic and it may be necessary to extend _sources
for that case.
Hi, here's the data for two derived sources:
sourceDisplays
[
{
"imageDisplay": {
"color": "255-255-255-255",
"contrastLimits": [
0.0,
143.0
],
"name": "C1-Live4_smallerView_tp_98-to-99",
"opacity": "0.2000",
"sources": [
"C1-Live4_smallerView_tp_98-to-99"
],
"showImagesIn3d": false,
"visible": true
}
},
{
"imageDisplay": {
"color": "255-255-255-255",
"contrastLimits": [
0.0,
143.0
],
"name": "C1-Live4_smallerView_tp_99-to-99",
"opacity": "1.0000",
"showImagesIn3d": false,
"sources": [
"C1-Live4_smallerView_tp_99-to-99"
],
"visible": true
}
}
]
transformations
[
{
"timepoints": {
"sources": [
"C1-Live4_smallerView"
],
"keep": false,
"name": "C1-Live4_smallerView_timepoints",
"parameters": [
[
99,
98
]
]
},
"sourceNamesAfterTransform": "C1-Live4_smallerView_tp_98-to-99"
},
{
"timepoints": {
"sources": [
"C1-Live4_smallerView"
],
"keep": false,
"name": "C1-Live4_smallerView_timepoints",
"parameters": [
[
99,
99
]
]
},
"sourceNamesAfterTransform": "C1-Live4_smallerView_tp_99-to-99"
}
]
I tried running add_view
with both the source names after transform as well as with the original source name and get:
AssertionError: The settings for C1-Live4_smallerView_tp_98-to-99 contain invalid sources: {'C1-Live4_smallerView_tp_98-to-99'} not in C1-Live4_smallerView
or
AssertionError: The settings for C1-Live4_smallerView_tp_98-to-99 contain invalid sources: {'C1-Live4_smallerView_tp_98-to-99'} not in C1-Live4_smallerView_tp_98-to-99
I tried again modifying one of the centrioles and its crop. Displayed both views (from same original source but different sourceDisplays
) in the viewer and saved that combined view.
This opens fine in MoBIE.
Again when trying to recreate that view in python, I get that strange error:
line 336, in get_view
assert len(invalid_sources) == 0,\
AssertionError: The settings for B-ALL_00_grid5_c0008 contain invalid sources: {'B-ALL_00_grid5_c0008'} not in B-ALL_00_grid5_c0008
Is your change in cd622e0 related to this @martinschorb?
(And I don't have much time to look into any of this right now, I can take another look next week).
Is your change in cd622e0 related to this @martinschorb?
Yes, I stumbled across this little bug when investigating the get_view
.
It seems to work now. I will look into the parameter checks again and then create a PR from the timepoints
branch that I am working on now for adding timepoint functionality.
(And I don't have much time to look into any of this right now, I can take another look next week).
Probably the timepoint stuff will be fully operational by then and you can check it out.
Ahhh.... same, same, over and over again...
Checked it again and of course, it is the list of sources going into get_view
that has to be list of lists...