Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make layer alpha configurable and generalize Rgb/Grayscale layer handling #3670

Merged
merged 8 commits into from
Jan 29, 2019

Conversation

daniel-wer
Copy link
Member

@daniel-wer daniel-wer commented Jan 23, 2019

  • Got rid of the abstract_plane_material_factory which was a legacy OOP artifact
  • Added an alpha property to the data layer configuration, which can be used to fade the different layers in and out
  • Generalized the handling of rgb and grayscale layers, so that rgb layers can now have any name (previously they needed to be named color) and more importantly a dataset can now consist of a mix of rgb and grayscale layers

Ideally, we should also avoid loading and prefetching data for layers whose alpha value is 0 (same as for the segmentation). To do that, I think it would be very beneficial to soften the specialized handling of the segmentation layer somewhat, which would make it easier to use the existing code for all layers. I'll do that in another PR (Issue: #3671) :)

URL of deployed dev instance (used for testing):

Steps to test:

  • Open a dataset with multiple layers and use the alpha slider in the dataset settings.
  • Create a dataset with an RGB and grayscale layer. Open it - all layers should be visible.
  • The screenshot tests are green (I'll test that)

Issues:


Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! That will be a really cool update 👍 I added some minor suggestions, but in general, it should be good to go!

Two additional comments:

  • I'm wondering whether we should rename "alpha" to "opacity" in the UI. Probably, the majority will instantly understand what "alpha" means, but I find "opacity" quite a bit clearer.
  • Can you rename the "Colors" header of the accordion settings to "Color Layers"?

function getColorLayerNames() {
return getColorLayers(Store.getState().dataset).map(layer => sanitizeName(layer.name));
}

class PlaneMaterialFactory extends AbstractPlaneMaterialFactory {
function getRgbLayerLookup(): { [string]: boolean } {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename it to getIsRgbLayerLookup()? Sounds a bit weird, but I think it reflects better what this function does (I was a bit confused at first, what the function does).

<div key={layerName}>
<Row>
<Col span={24}>
<Tag color={isRGB && "#1890ff"}>{isRGB ? "24-bit" : "8-bit"} Layer</Tag> {layerName}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the Tag be made non-clickable? Otherwise, it feels like something is broken, since nothing happens if you click it.
Also, I'd swap the order of tag and name, so that the name comes first. Then, it "acts as a headline" for the whole layer segment (maybe making it bold would make sense, too). The tag would be more of an addendum in that case.

isLastLayer: boolean,
) => {
const isRGB = isRgb(this.props.dataset, layerName);
// $FlowFixMe Object.entries returns mixed for Flow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that flow does not complain at the call side, since this function closely defines that a DatasetLayerConfiguration is needed 🤔

@@ -106,7 +106,7 @@
font-size: 14px;
}

.settings-row {
.margin-bottom {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -86,12 +86,14 @@ function SettingsReducer(state: OxalisState, action: Action): OxalisState {
(result, layer) => {
if (initialLayerSettings != null && initialLayerSettings[layer.name] != null) {
result[layer.name] = initialLayerSettings[layer.name];
if (initialLayerSettings[layer.name].alpha == null) result[layer.name].alpha = 100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the logic here so that each initialLayerSetting is merged with the default settings (lines 93 to 96), so that only the missing values are set? That way, we wouldn't handle alpha as a special case (for which the default value is defined twice at the moment).

@daniel-wer daniel-wer merged commit 85fe219 into master Jan 29, 2019
@daniel-wer daniel-wer deleted the layer-opacity branch January 29, 2019 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make layers toggleable
2 participants