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

Visualization of a SAR image as a ground surface added #24

Merged
merged 7 commits into from
Apr 8, 2022

Conversation

MargrietGroenendijk
Copy link
Contributor

@MargrietGroenendijk MargrietGroenendijk commented Apr 4, 2022

First iteration of this type of image, which uses a blob to be able to display the data. This PR will make it possible to test this on TileDB Cloud in the next deployment.

Example API call to create this new visualization:

show.from_array(array_uri="autzen-sar-gec",
                style = 'ground',
                band = band,
                xy_bbox = [11500,14000,11500,14000],
                attribute = 'TDB_VALUES',
                scale_factor = scale_factor,
                width = 1000,
                height = 800,
                inspector = True)

@MargrietGroenendijk MargrietGroenendijk marked this pull request as draft April 5, 2022 13:24
@MargrietGroenendijk MargrietGroenendijk marked this pull request as ready for review April 5, 2022 15:50
@@ -68,6 +68,8 @@ def set_defaults(validator, properties, instance, schema):

mbrs_schema = deepcopy(core_schema)

ground_schema = {"type": "object"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you expand this and add the JSON schema elements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, this is now as the below. Also added image_type to be able to add different types of data later.

ground_schema = {
    "type": "object",
    "properties": {
        "inspector": {"type": "boolean", "default": False},
        "image_type": {"type": "string", "default": "general"},
        "width": {"type": "number", "default": 800},
        "height": {"type": "number", "default": 600},
        "z_scale": {"type": "number", "default": 1},
        "wheel_precision": {"type": "number", "default": -1},
        "xy_bbox": {"type": "array", "default": [0, 1, 0, 1]},
        "band": {"type": "number", "default": 1},
        "scale_factor": {"type": "number", "default": 1},
        "img_width": {"type": "number"},
        "img_height": {"type": "number"},
    },
    "required": ["xy_bbox", "img_width"],
}

io_buf = io.BytesIO(buffer)
return io_buf.read()

bbox = kwargs["bbox"]
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be marked as required in the ground schema

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this, see the schema above

with tiledb.open(array_uri, "r") as arr:
img = arr[nr, bbox[0] : bbox[1], bbox[2] : bbox[3]][kwargs["attribute"]]

img_norm = 20 * np.log10(img * kwargs["scale_factor"])
Copy link
Contributor

Choose a reason for hiding this comment

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

This scaling is specific to this SAR image, can we rename the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved this by adding a parameter image_type that only does this conversion when image_type == "sar"

Renamed scale_factor to sar_scale_factor to make this clearer as well

@@ -260,16 +261,16 @@ export class BabylonMBRSView extends BabylonBaseView {
const maxz = extents[5];

const scale = this.zScale;

Copy link
Contributor

Choose a reason for hiding this comment

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

whitespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@MargrietGroenendijk MargrietGroenendijk merged commit 64ff1c8 into main Apr 8, 2022
@gsakkis gsakkis deleted the mg/ground_scene branch June 5, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants