To write your modules, you have access to a number of mathematical classes already defined in SliceOmatic's libraries:
The Vect class is a 4D Vector
The Matrix class is a 4x4 transformation matrix
The Point_2D, Point_3D and Point_4D classes are used to define 2 to 4 dimension coordinate position in space.
The Region_2D, Region_3D and Region_4D classes are used to define 2 to 4 dimensions region in space.
SliceOmatic use a number of coordinate systems:
The 3D systems
Org: Original 3D system.
this is the 3D patient system as defined by DICOM,
x increase from left to right
y increase from front to back
z increase from head to feet
from Frm to Org:
x = (frm.x * inc.x + org.x) * dir_x.x
+ (frm.y * inc.y + org.y) * dir_y.x ;
y = (frm.x * inc.x + org.x) * dir_x.y
+ (frm.y * inc.y + org.y) * dir_y.y ;
z = (frm.x * inc.x + org.x) * dir_x.z
+ (frm.y * inc.y + org.y) * dir_y.z ;
where inc=pixel size, org=image's origin and dir are the direction vectors
Org to Frm
Org to 3D
3D: Transformed 3D space
This is the 3D system where all the objects have been placed.
The 2D systems
Frm: Frame space
This system is defined by the image pixels in each frames.
It start at 0,0 at the top left corner of the image.
The units are the image pixels.
The Frame class contain the m_mat_2D_3D and m_mat_3D_2D matrix to change from 2D frame space to 3D Org space.
Frm to Org (In sliceO_class_frame.hpp)
Point_3D SliceO_Frame::Frm_2_Org( Point_2D ) ;
Region_3D SliceO_Frame::Frm_2_Org( Region_2D ) ;
Frm to Inf (In sliceO_class_frame.hpp)
Point_2D SliceO_Frame::Frm_2_Inf( SliceO_Window *window, Point_2D ) ;
Region_2D SliceO_Frame::Frm_2_Inf( SliceO_Window *window, Region_2D ) ;
Inf: Infinite screen space
All the image(s) fit in this space. and the scale factor is already taken into account. (a 100x100 image with a scale fact of 3 will take 300x300 pixels). Since the Inf space pos of an image depend on the display mode of each window, there's different Inf coord for each window.
It start at 0,0 at the top left corner of the image.
The units are the screen pixels.
Inf to Frm (In sliceO_class_frame.hpp)
Point_2D SliceO_Frame::Inf_2_Frm( SliceO_Window *window, Point_2D ) ;
Region_2D SliceO_Frame::Inf_2_Frm( SliceO_Window *window, Region_2D ) ;
Inf to Wnd (In sliceO_class_window.hpp)
Point_2D SliceO_Window::Inf_2_Wnd( Point_2D ) ;
Region_2D SliceO_Window::Inf_2_Wnd( Region_2D ) ;
Wnd: Window space
This system is defined by the actual display window. It display part (or all) of the Inf space. If not all Inf space can fit in the window, x and Y sliders are used.
It start at 0,0 at the bottom left corner of the window.
Wnd to Inf (In sliceO_class_window.hpp)
Point_2D SliceO_Window::Wnd_2_Inf( Point_2D ) ;
Region_2D SliceO_Window::Wnd_2_Inf( Region_2D ) ;