Shifted and pivoted coordinate system

File Information

Description

These lines of code create two layers that represent X and Y values of a coordinate system that has been shifted and pivoted to fit to a given structure.

There are cases where it is quite useful to have an auxiliary coordinate system which is adapted to an object with a distinct shape that may be oriented in the image in an arbitrary way. Say for example you have a set of images of embryonic rats. They all have a head and a tail, you can see feet, but they are oriented in the images in arbitrary ways, similar to the attached image examples.

In such cases, it can be quite useful to have a coordinate system where the origin (coordinates (0;0) ) is always at the same position with respect to the object – in the example we picked the outermost tip of the tail. A second point within the object – and here we are picking the geometrical center of mass of the animal’s head – defines the direction of the y-axis.

To nail down another degree of freedom you can make a decision on the normalization of your coordinate system. I would say there are two useful definitions: One would be to ensure that the euklidian distances remain conserved. In particular and in this example, if the distance between the tail tip (the origin of the coordinate system) and the head center of mass is N pixels (use Pythagoras to find out), then the latter should have the coordinates (0;N). Another useful normalization would be to give that known second point in the object the coordinates (0;1). The latter approach is especially useful if you have objects of different sizes or images of different resolutions, because then you can locate say an organ that you expect in a certain region within the object (the animal) by addressing that region in coordinates typically between 0 and 1.

One last calibration can be important if your animals may be looking left or right. Then it might make sense to give up the idea that the x- and y-axes are right and up (or x-axis your thumb, y-axis your index finger) and require that for example the animal is looking towards the positive x-direction. In the code provided this is implemented by checking whether the front foot has positive x-values, and if not, apply x --> -x to the system.

Most of the code provided is just preparation in order to get defined points within the animal. If you want to apply it to your own task, you have to write your own code that finds useful reference points (origin and point on the y-axis), then copy the lower part of the ruleset.

Software Version
Definiens Developer XD - 1.5
Categories
Other
Files in Rule Set
  • orientation.dcp(175 KB )
  • Rats.zip(298 KB )
  • Result.jpg(47 KB )
  • For downloading this file, please login or sign up for a new account.
Views
699
Downloads
14
Created
11/26/2010

User Information

Please log in to comment on this rule set or to download the attached files.

If you do not have an account please register here.

Comments

This rule set has not been commented yet.