Closed martinschorb closed 1 year ago
The code that I like to implement this into is here: https://github.com/mobie/mobie-utils-python/blob/a6f0db9807fb303deb2b025d61f80feeddb180a1/mobie/metadata/timepoint_view_metadata.py#L57
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 https://github.com/mobie/mobie-utils-python/blob/d9449ec268a60b2e9a78a1a7ca14b3fd649ad54b/mobie/metadata/view_metadata.py#L335
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
}
}
]
[
{
"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 https://github.com/mobie/mobie-utils-python/commit/cd622e07dceaf68f9954746a4d03c69f9e29266b 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...
Hi,
I have a convoluted view where I have specific
imageDisplay
sets for differently transformed versions of a single source (throughsourceNamesAfterTransform
). 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 differentsourceNamesAfterTransform
from one source).It seems
get_view
needs all sources to be specified in the parameters https://github.com/mobie/mobie-utils-python/blob/d9449ec268a60b2e9a78a1a7ca14b3fd649ad54b/mobie/metadata/view_metadata.py#L335so 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?