Skip to content

Conversation

braincore
Copy link

No description provided.

@Grahldg
Copy link
Contributor

Grahldg commented Sep 19, 2018

Hi @braincore , thanks for your PR.

The calculation does appear to be correct. The methods are based on those from the ST API, and the lines of code relative to your commit are based on the following from ST:

	user_zone.x_centre = (pRoi->BotRightX + pRoi->TopLeftX  + 1) / 2;
	user_zone.y_centre = (pRoi->TopLeftY  + pRoi->BotRightY + 1) / 2;
	user_zone.width =    (pRoi->BotRightX - pRoi->TopLeftX);
	user_zone.height =   (pRoi->TopLeftY  - pRoi->BotRightY);
	if ((user_zone.width < 3) || (user_zone.height < 3))

Height is calculated as TopLeftY - BotRightY. I found that the way the array is laid out is somewhat counterintuitive. The upper left corner of the array has coordinates (0, 15) and the lower right corner has coordinates (15, 0) and the upper right and lower left corners of your custom array need to be set. For example a possible 4x4 array could have coordinates (7, 11) for the upper left and (11, 7) for the lower right. I found that I had to draw a diagram in order to get my points to work out and to set the custom array successfully. Please let me know if you have any other questions.

@braincore
Copy link
Author

Sorry for the confusion! I had altered getUserRoi function in such a way that setUserRoi(getUserRoi()) was not round tripping properly, and wrongly changed setUserRoi rather than undo my getUserRoi changes. I'll abandon this.

@braincore braincore closed this Sep 19, 2018
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