Creating templates for reproducible measurement

Hi all, I am currently working on a small project on how to analyse the uniformity on an image, using ImageJ and standardize the method in order for all the users to have same results.But first let me go through a bit of background.
In radiotherapy physics departments there are multiple machines producing radiation. One of our monthly QA checks in the superficial treatment machine is irradiating a Gafchromic film (a film that changes color if it is irradiated) and check that the central mean value of a circular applicator and and 4 points (two on top and bottom of the center and two on left and right) are within 5% of the central mean value.
The following paragraph is taken from the work instructions that we are currently using: ''To open in ImageJ the format may need converting to .PNG. Do this with MSPaint). Open the image in ImageJ. To get the most dose-sensitive colour channel select Image->Color->Split Channels and select the RED channel. Check that Image-Type is set to “8-bit”. Select the rectangle tool and select a region approx 100x100 pixels (can be smaller for the smallest applicators). Press M (or Analyse->Measure) to get the stats for that region. Record the mean readings.
Is there a way to create templates so that the readings recorded could be reproduced for multiple users? What I am trying to do actually is create 8 circles of varying radius with 5 predefined squares of 100x100 pixels, so I can attach the template on the desired applicator. I would appreciate any help or solution.


Good day Lefteris,

as fas as I understand what you in principle want, it appears to be possible. What we need is an original image and an example of how you think the template should look like.

An important aspect that isn’t directly related to what you want but that should thoroughly be reflected, is the image file format. I would never ever use MSPaint for this purpose and although PNG is indeed a possible format, I would use the TIF-format whenever possible. However, you should try to use the original image format for the import to ImageJ, perhaps by considering the BioFormats importer. Could you please tell us how the images are captured (Camera/Scanner of what type) and what format the original images presently have and why?



Hi Herbie,

As I have mentioned before the Gafchromic film has the ability to change colour when it is exposed to radiation. It is basically a piece of film that we place on the surfaces that we need to check for radiation leakage or check the uniformity of a field. After exposing the film we scan it on the scanner/printer that we have in the department (TASKalfa 4501i Kyocera) and we are using the highest scan resolution 600x600 and we send it across as jpeg. There is the option to send as tif format as well.
The following image depicts what we are getting before converting to png format.

And the same image as tif format.

The following image depicts the representative template we are looking for. Ideally I would like to create 8 different templates for all the applicators of different diameter.

Thank you.

Good day Lefteris,

thanks for the images and please understand that the task is still far from clear to me. You need to be much more precise and detailed in your explanations.

The posted image in TIF-format was JPG-compressed before which is a no-no for any kind of serious image evaluation.

Please make sure that your scanner delivers an uncompressed image either in TIFF, PNG or RAW-format. JPG-compression introduces artifacts that can’t be removed. In your case the signal is quite faint and JPG-compression has a considerable alterating impact on it.

In your annotated image I see 5 squares (100x100 pixel^2 ROIs) in which I expect that you like to measure the image statistics. The positions of these 5 ROIs are clearly explained but I wonder how they are related to the black marks of the black circular line.

If you want to automatically set the ROIs, we need to know how to deal with the film rotation. I guess the marks are manually set but according to what rule or feature?

Ideally I would like to create 8 different templates for all the applicators of different diameter.

How do the others look like and what ROIs do you like to set for them?

We need your co-operation otherwise it is no fun helping you.



I guess the images show exposed film, i.e. the disc region. Outside the film was not exposed. Is that right?

We normally expose the films and then we scan them as we need them for keeping a record of the QA exposure. The scanner is a commercial multi purpose photocopier and we are using it to scan the films. The only settings that can be altered are the ones depicted in the following image. Then we email the scanned film to our emails. Unfortunately, I do not think that there is a way to get a uncompressed TIFF, PNG or RAW format. The following image depicts the scanning settings available.

The 5 ROIs are where I need to measure statistics and use it as a template for all the users. The following image can explain a lot.

The circular applicators are the cone like things on the right of the image. The black marks are drawn by the physicist carrying out the QA exposure of the film and they represent the red lines. The red lines are there to define the center of the field. It is useful to mark them as we need to analyse the uniformity of the exposure across those areas. The other black line that surrounds the exposed film is to define the applicators’ diameter. The inner black disk is where we expose the film to radiation. The metal bit of the applicator along with the glass end is there to restrict any radiation escaping.
Ideally the rotation should be A=Left, B=Right, G=Top and T=Bottom.
The 8 templates that we try to create are representing the different diameter applicator, as depicted on the image above.

Thanks for the details.

I think for quality control you need to be vey careful and that’s why I insist to understand the situation the best possible!

File format TIF of the Scanner should be OK but be careful because later your eMail program may change them to JPG (therefore, I recommend to ZIP the TIF-files before sending them per eMail). I don’t think that the previously posted sample image was an original TIF from your scanner.

Ideally the rotation should be A=Left, B=Right, G=Top and T=Bottom.

My question was a different one.
If you look at your previously provided drawing of the desired ROIs etc., you will see that the central cross in yellow is oriented according to the four little metal marks. Consequently the cross isn’t perfectly horizontally/vertically oriented and this holds for the ROI-positions as well.

In order to position the ROIs correctly, we need to analyze the positions of the four little metal marks in the image. However, the A, B, G, T labeling makes the automatic detection of these marks quite inconvenient and less robust than necessary.

Regarding the various applicator sizes, do you want the image analysis to detect the size automatically. Does the ROI sizes stay the same for all sizes? If not, as you’ve mentioned earlier, how do they differ?

Finally please tell us if you have a budget for this work, otherwise we feel unable to perform this task in a professional way, i.e. in a way that conforms with your demands on quality control.



Please let me add some more consideration concerning the film evaluation:

  1. I’m sure you know the mathematical relationship between the irradiation of the film and its opaqueness/coloring.
  2. However, do you know how the opaqueness is to be measured and if the relation between the irradiation of the film and the evaluation of a single color channel (red) is known?
  3. What you really need to know is the relationship between the irradiation of the film and the measurments made in a single color channel after the scanning.
  4. An important part of the whole processing is the nonlinearity of the scanner, described by its gamma. Is it considered?
  5. Did you ever experimentally test the whole processing chain from defined physical irradiations to what you measure in a single color channels of the scan?
  6. I guess the mathematical overall relationship is highly non-linear and this is not only important for absoute measurements but for relative measuremenst as well.

Good day to ya. Attached is an image which I think you may be looking to do.
File > Open (image of concern), goto Image > Type > 32 bit
Edit > Invert then apply LUT, I used 6 shades, you may decide on another.
File > Open (Template)- again 32 bit inverted,no LUT
then: Image > Overlay > Add image (at Opacity 50% and check Zero transparent.
This can be automated by making a macro and all images should always be consistant in size of image area, not necessarily the film image size so you may use any of your “Jigs” as I call them. The template image can be used repeatedly and modifyed as needed.
Good Luck,