VisExercises
Exercise 2
← Exercise 1 | ● | Exercise 3 →
Programming with DCMTK
Exercise (2a)
- Build a Qt example application.
- Checkout the Qt frame work available via SVN from here:
svn://schorsch.efi.fh-nuernberg.de/qt-framework - Make sure you have the Qt and libz developer libraries installed:
sudo apt-get install libqt4-dev libz-dev - Build the Qt example using CMake style.
- Checkout the Qt frame work available via SVN from here:
- Modify the painterwidget.cpp module as follows:
- Draw a blue line from the bottom left to the top right corner of the central painter widget :
painter.setPen(Qt::blue); painter.drawLine(rect().bottomLeft(),rect().topRight());
- Draw another line to get a “X”.
- Use a different pen (QPen) for the line, i.e. use a green pen with a width of 10 pixels.
- Draw another line to get a “X”.
Exercise (2b)
- If the mouse is on the left side, the line should be displayed with a line thickness of 10 pixels, on the right side the line thickness should change to 100, and to according widths in between. To accomplish this, we need to interpolate linearly between the two extrema as follows:
- First, we override the mouseMoveEvent() method of the central painter widget (that is the class PainterWidget). Then we fetch the mouse coordinates from the delivered event, map the x coordinate (in the range [0,width()]) to an interpolation coefficient u (in the range [0,1]).
- With the interpolation coefficient u we linearily interpolate the pixel size between 10 and 100 pixels. Use painter.setPen(QPen(Qt::blue, width)) to set the line width to the respective pixel size after triggering a new paint event with update().
Home work (2c)
- Check that the frame work interoperates properly with DCMTK by
- including the DCMTK headers and
- linking the app with the DCMTK library → requires the BUILD_WITH_DCMTK option to be enabled
- enable the option via ccmake →
ccmake .
- or use the option direkctly with cmake →
cmake -DBUILD_WITH_DCMTK=1 .
- enable the option via ccmake →
- Extend the Qt example application to read the patient name tag of a particular Dicom file given as command line argument in main.cpp
- Pass the patient name to the PainterWidget via according setters.
- Display the patient name in the Qt window by modifying the PainterWidget and its paintEvent method.
- Print the modified files and submit.
- What patient, institution and performing physician names are given in the two Dicom files of the previous exercise?
- Print a screen shot of the Qt example application for each Dicom image.
Home work (2d)
- Calculate on paper: Interpolate a voxel with alternating scalar values 0 and 1 given at the corners with the trilinear interpolation coefficients u=0.25, v=0.5, w=0.75.
← Exercise 1 | ● | Exercise 3 →