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

Show dataset extent in right menu tab #3371

Merged
merged 9 commits into from
Oct 25, 2018

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Oct 18, 2018

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • open a tracing and then open the info tab in the right menu
  • it should now display the dataset extent

Issues:


@MichaelBuessemeyer
Copy link
Contributor Author

@philippotto I have two ways of implementing the aggregateBoudingBox function. The current one and the one one commit before. Please compare those and tell me which one is better. I personally prefer the current version, because it is shorter and makes fully use of the standart js api 🙂

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.

Nice work 👍 I left some refactoring suggestions, though :)

const minZ = Math.min(...allZCoordinates);
const maxX = Math.max(...allXCoordinates);
const maxY = Math.max(...allYCoordinates);
const maxZ = Math.max(...allZCoordinates);
Copy link
Member

Choose a reason for hiding this comment

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

Can you refactor this to avoid repetition? E.g., lines 134 to 142 can be shortened by mapping [0, 1, 2], and for lines 143 to 148 should also be a shorter way. E.g., const min = [0, 1, 2].map(idx => Math.min(...allCoordinates[idx]))?

function getDatasetExtentInVoxel(dataset: APIDataset) {
const datasetLayers = dataset.dataSource.dataLayers;
const allBoundingBoxes = datasetLayers.map(layer => layer.boundingBox);
const unifiedBoudingBoxes = aggregateBoundingBox(allBoundingBoxes);
Copy link
Member

Choose a reason for hiding this comment

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

typo in unifiedBoudingBoxes

const extent = getDatasetExtentInLength(this.props.dataset);
const datsetExtents = [
`${extentInVoxel.width} x ${extentInVoxel.height} x ${extentInVoxel.depth}`,
formatExtentWithLength(extent),
Copy link
Member

Choose a reason for hiding this comment

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

Slight refactoring potential: How about formatExtentWithLength also accepts a second parameter which is a function which formats a value. So, you would call formatExtentWithLength(extent, formatNumberToLength). And in the line above, you could write formatExtentWithLength(extent, x => x) since the pure voxel count is not formatted.
That way, these two lines would unified a bit and the x logic only exists once.

Copy link
Member

Choose a reason for hiding this comment

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

Independent of that: I wouldn't define these two extents in an array and access them individually. Instead, maybe just inline them into the <td />s each?

<td>{datsetExtents[0]}</td>
</tr>
<tr>
<td />
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it is clear from a UI perspective that this row displays the extent in voxels? Maybe it should read that somewhere (either in the first cell of the row) or "5 x 10 x 15 Voxel" or (more mathematically correct) "5 Voxel x 10 Voxel x 15 Voxel" or "5 x 10 x 15 Voxel³". What do you think, @MichaelBuessemeyer @daniel-wer ?

@philippotto
Copy link
Member

philippotto commented Oct 18, 2018

@philippotto I have two ways of implementing the aggregateBoudingBox function. The current one and the one one commit before. Please compare those and tell me which one is better. I personally prefer the current version, because it is shorter and makes fully use of the standart js api slightly_smiling_face

Ah, now I see this comment. Yes, the second version is definitely better! I think there is still potential to make it even more concise, though :) (see my other comment)

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, looks good 👍

@MichaelBuessemeyer MichaelBuessemeyer merged commit 6a732d7 into master Oct 25, 2018
jfrohnhofen added a commit that referenced this pull request Oct 26, 2018
* origin/master:
  Add debugging methods to visualize wireframe of buckets (#3402)
  fixed bug that selects a just removed layout (#3379)
  Added button to revoke admin rights in frontend (#3378)
  Revert "Add REST API versioning support (#3385)" (#3404)
  Add REST API versioning support (#3385)
  limit number of tasks to be created in one api request (#3386)
  Use correct volume download route in TracingStoreRpcClient (#3403)
  clearer error message when uploading nml for inaccessible dataset (#3390)
  Refactored dropdown item events (#3383)
  Show dataset extent in right menu tab (#3371)
@normanrz normanrz deleted the show-dataset-extent-in-tracing branch February 20, 2019 16:35
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.

Show dataset extent (in voxel and mm) in info tab
2 participants