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

Enable custom resolution #148

Merged
merged 4 commits into from Mar 17, 2023
Merged

Enable custom resolution #148

merged 4 commits into from Mar 17, 2023

Conversation

fsdavid
Copy link
Collaborator

@fsdavid fsdavid commented Feb 14, 2023

No description provided.

@fsdavid fsdavid requested a review from xgui3783 March 13, 2023 15:19
Copy link
Member

@xgui3783 xgui3783 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

Can you take a look at the comments?

selectedResolutionX: 0,
selectedResolutionY: 0,
selectedResolutionZ: 0,
voxelSpace: true
Copy link
Member

Choose a reason for hiding this comment

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

variable should be more specific. either useVoxelSpace or useVoxelSpaceFlag to indicate it is a boolean.

currently, this variable can be misunderstood as a custom coordinate space

@@ -296,7 +353,12 @@ export default {
scaleMax: 10,
scaleStep: 0.01,

testValue: 0
testValue: 0,
Copy link
Member

Choose a reason for hiding this comment

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

not used?

Comment on lines +358 to +360
selectedResolutionX: 0,
selectedResolutionY: 0,
selectedResolutionZ: 0,
Copy link
Member

Choose a reason for hiding this comment

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

I think these should be computed properties, rather than data.

They can be computed based on scale and selectedIncomingVolumeResolution{X,Y,Z}

Comment on lines 379 to 380
'selectedIncomingVolumeResolution',
'selectedIncomingVolumeSize'
Copy link
Member

Choose a reason for hiding this comment

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

I thought these are already available in selectedIncomingVolume ? I could be wrong

@@ -328,6 +392,7 @@ export default {
return this.testScale[0]
},
set: function (value) {
this.selectedResolutionX = Math.round(+this.testScaleX * this.selectedIncomingVolumeResolutionX)
Copy link
Member

Choose a reason for hiding this comment

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

ditto comment above (that selectedResolution{X,Y,Z} should be computed property)

if they are computed property, you will not need to manually set them.

Comment on lines 407 to 409
this.selectedResolutionY = Math.round(+this.testScaleY * this.selectedIncomingVolumeResolutionY

)
Copy link
Member

Choose a reason for hiding this comment

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

ditto above

@@ -350,6 +418,7 @@ export default {
return this.testScale[2]
},
set: function (value) {
this.selectedResolutionZ = Math.round(+this.testScaleZ * this.selectedIncomingVolumeResolutionZ)
Copy link
Member

Choose a reason for hiding this comment

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

ditto above

@@ -610,7 +710,43 @@ export default {
name: `flip on axis ${axis}`
})
this.flipAxis({ axis })
},
setResolution: function () {
const isotropic = +this.selectedResolutionX === +this.selectedResolutionY && +this.selectedResolutionY === +this.selectedResolutionZ
Copy link
Member

Choose a reason for hiding this comment

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

I am somewhat confused.

isotropic is a state that's set by the user, not computed on the fly.

This should be a simple check if (this.isotropic) ? Or am I missing something?

if (isotropic) {
this.setIsotropicScale(+this.selectedResolutionX/this.selectedIncomingVolumeResolutionX)
} else {
this.isotropic = false
Copy link
Member

Choose a reason for hiding this comment

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

ditto above.

this.isotropic should be a state that is exclusively controlled by the user. the application should not be able to influence it.

@@ -610,7 +710,43 @@ export default {
name: `flip on axis ${axis}`
})
this.flipAxis({ axis })
},
setResolution: function () {
Copy link
Member

Choose a reason for hiding this comment

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

[minor point] it is slightly awkward to use the oninput to trigger state update.

It would probably more declarative to use a watch: { selectedResolutionX }, or indeed, if we are using computed properties, a setter method for the computed property to trigger state update.

semantically, it makes more sense (e.g. anything in the component can trigger a method call. But if the update state is hooked to a watch hook or setter, then only value update triggers the state update)

@fsdavid fsdavid marked this pull request as draft March 14, 2023 10:40
@xgui3783
Copy link
Member

@fsdavid , on further contemplation, since we are strapped for time, we can merge this. (also since we will, one day, swap out with the new version, so the commits likely won't be permanent either.)

(Apologies if you have already spent time on this)

@fsdavid
Copy link
Collaborator Author

fsdavid commented Mar 17, 2023

Nice, I will merge

@fsdavid fsdavid marked this pull request as ready for review March 17, 2023 13:06
@fsdavid fsdavid merged commit 4448e87 into dev Mar 17, 2023
@xgui3783 xgui3783 deleted the voxel_res_133 branch February 16, 2024 09:47
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.

None yet

2 participants