Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
b9dd3264
Commit
b9dd3264
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
OpenVolume fixes
parent
7620a2e8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-plugin/state/actions/basic.ts
+12
-8
12 additions, 8 deletions
src/mol-plugin/state/actions/basic.ts
src/mol-plugin/state/transforms/representation.ts
+2
-0
2 additions, 0 deletions
src/mol-plugin/state/transforms/representation.ts
with
14 additions
and
8 deletions
src/mol-plugin/state/actions/basic.ts
+
12
−
8
View file @
b9dd3264
...
@@ -16,6 +16,7 @@ import { StateTransforms } from '../transforms';
...
@@ -16,6 +16,7 @@ import { StateTransforms } from '../transforms';
import
{
Download
}
from
'
../transforms/data
'
;
import
{
Download
}
from
'
../transforms/data
'
;
import
{
StructureRepresentation3DHelpers
,
VolumeRepresentation3DHelpers
}
from
'
../transforms/representation
'
;
import
{
StructureRepresentation3DHelpers
,
VolumeRepresentation3DHelpers
}
from
'
../transforms/representation
'
;
import
{
getFileInfo
,
FileInput
}
from
'
mol-util/file-info
'
;
import
{
getFileInfo
,
FileInput
}
from
'
mol-util/file-info
'
;
import
{
Task
}
from
'
mol-task
'
;
// TODO: "structure/volume parser provider"
// TODO: "structure/volume parser provider"
...
@@ -176,8 +177,10 @@ function getVolumeData(format: VolumeFormat, b: StateTreeBuilder.To<PluginStateO
...
@@ -176,8 +177,10 @@ function getVolumeData(format: VolumeFormat, b: StateTreeBuilder.To<PluginStateO
function
createVolumeTree
(
format
:
VolumeFormat
,
ctx
:
PluginContext
,
b
:
StateTreeBuilder
.
To
<
PluginStateObject
.
Data
.
Binary
|
PluginStateObject
.
Data
.
String
>
):
StateTree
{
function
createVolumeTree
(
format
:
VolumeFormat
,
ctx
:
PluginContext
,
b
:
StateTreeBuilder
.
To
<
PluginStateObject
.
Data
.
Binary
|
PluginStateObject
.
Data
.
String
>
):
StateTree
{
return
getVolumeData
(
format
,
b
)
return
getVolumeData
(
format
,
b
)
.
apply
(
StateTransforms
.
Representation
.
VolumeRepresentation3D
,
.
apply
(
StateTransforms
.
Representation
.
VolumeRepresentation3D
)
VolumeRepresentation3DHelpers
.
getDefaultParamsStatic
(
ctx
,
'
isosurface
'
))
// the parameters will be used automatically by the reconciler and the IsoValue object
// will get the correct Stats object instead of the empty one
// VolumeRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'isosurface'))
.
getTree
();
.
getTree
();
}
}
...
@@ -203,21 +206,22 @@ export const OpenVolume = StateAction.build({
...
@@ -203,21 +206,22 @@ export const OpenVolume = StateAction.build({
[
'
auto
'
,
'
Automatic
'
],
[
'
ccp4
'
,
'
CCP4
'
],
[
'
mrc
'
,
'
MRC
'
],
[
'
map
'
,
'
MAP
'
],
[
'
dsn6
'
,
'
DSN6
'
],
[
'
brix
'
,
'
BRIX
'
]
[
'
auto
'
,
'
Automatic
'
],
[
'
ccp4
'
,
'
CCP4
'
],
[
'
mrc
'
,
'
MRC
'
],
[
'
map
'
,
'
MAP
'
],
[
'
dsn6
'
,
'
DSN6
'
],
[
'
brix
'
,
'
BRIX
'
]
]),
]),
}
}
})(
async
({
params
,
state
},
ctx
:
PluginContext
)
=>
{
})(({
params
,
state
},
ctx
:
PluginContext
)
=>
Task
.
create
(
'
Open Volume
'
,
async
taskCtx
=>
{
const
dataTree
=
state
.
build
().
toRoot
().
apply
(
StateTransforms
.
Data
.
ReadFile
,
{
file
:
params
.
file
,
isBinary
:
true
});
const
dataTree
=
state
.
build
().
toRoot
().
apply
(
StateTransforms
.
Data
.
ReadFile
,
{
file
:
params
.
file
,
isBinary
:
true
});
const
volumeData
=
await
ctx
.
runTask
(
state
.
updateTree
(
dataTree
));
const
volumeData
=
await
state
.
updateTree
(
dataTree
)
.
runInContext
(
taskCtx
);
// Alternative for more complex states where the builder is not a simple StateTreeBuilder.To<>:
// Alternative for more complex states where the builder is not a simple StateTreeBuilder.To<>:
/*
/*
const dataRef = dataTree.ref;
const dataRef = dataTree.ref;
await
ctx.runTask(
state.updateTree(dataTree));
await state.updateTree(dataTree)
.runInContext(taskCtx
);
const dataCell = state.select(dataRef)[0];
const dataCell = state.select(dataRef)[0];
*/
*/
const
format
=
getFileFormat
(
params
.
format
,
params
.
file
,
volumeData
.
data
as
Uint8Array
)
const
format
=
getFileFormat
(
params
.
format
,
params
.
file
,
volumeData
.
data
as
Uint8Array
)
;
const
volumeTree
=
state
.
build
().
to
(
dataTree
.
ref
);
const
volumeTree
=
state
.
build
().
to
(
dataTree
.
ref
);
return
state
.
updateTree
(
createVolumeTree
(
format
,
ctx
,
volumeTree
));
// need to await the 2nd update the so that the enclosing Task finishes after the update is done.
});
await
state
.
updateTree
(
createVolumeTree
(
format
,
ctx
,
volumeTree
)).
runInContext
(
taskCtx
);
}));
export
{
DownloadDensity
};
export
{
DownloadDensity
};
type
DownloadDensity
=
typeof
DownloadDensity
type
DownloadDensity
=
typeof
DownloadDensity
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/state/transforms/representation.ts
+
2
−
0
View file @
b9dd3264
...
@@ -233,6 +233,8 @@ const VolumeRepresentation3D = PluginStateTransform.BuiltIn({
...
@@ -233,6 +233,8 @@ const VolumeRepresentation3D = PluginStateTransform.BuiltIn({
const
repr
=
provider
.
factory
({
webgl
:
plugin
.
canvas3d
.
webgl
,
...
plugin
.
volumeRepresentation
.
themeCtx
},
provider
.
getParams
)
const
repr
=
provider
.
factory
({
webgl
:
plugin
.
canvas3d
.
webgl
,
...
plugin
.
volumeRepresentation
.
themeCtx
},
provider
.
getParams
)
repr
.
setTheme
(
createTheme
(
plugin
.
volumeRepresentation
.
themeCtx
,
{
volume
:
a
.
data
},
params
))
repr
.
setTheme
(
createTheme
(
plugin
.
volumeRepresentation
.
themeCtx
,
{
volume
:
a
.
data
},
params
))
// TODO set initial state, repr.setState({})
// TODO set initial state, repr.setState({})
// TODO include isoValue in the label where available
console
.
log
(
params
.
type
.
params
);
await
repr
.
createOrUpdate
(
props
,
a
.
data
).
runInContext
(
ctx
);
await
repr
.
createOrUpdate
(
props
,
a
.
data
).
runInContext
(
ctx
);
return
new
SO
.
Volume
.
Representation3D
(
repr
,
{
label
:
provider
.
label
});
return
new
SO
.
Volume
.
Representation3D
(
repr
,
{
label
:
provider
.
label
});
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment