Medical physics

I am producing plugins for performing QC, for instance to perform Gamma camera image quality analysis in accordance with NEMA guidelines. I am keen to share knowledge with other med phys developers engaged in this activity. One challenge I am currently facing is how best to segment images of phantoms into relevant ROI.

If you could provide some example images, we could suggest potential segmentation approaches!

This is the simplest kind of image I wish to analyse. This is an image produce duing a gamma camera uniformity test, and consists of camera pixel data surrounded by a mask of value 0. I wish to first select the useful field of view (UFOV, bright region, eg using an edge filter or thresholding), then I wish to select only the central field of view (CFOV), which is the area defined by scaling all linear dimensions of the UFOV by 75%.

In other tests, the UFOV may be circular, and contain sub regions of interest which I would also want to extgract programatically.

for example

Hi Rob,
the following small macro should do, what you actually need for the first type of images if I understood your question correctly. It will give you the ROI manager with the two ROIs. In this case I created the bounding box around the region since the outer most pixel row contains also pixels with the value 0 which would lead to a non-straight border of the ROI. If you definitely want to exclude all the 0 value pixels just delet the run("To Bounding Box"); part of the macro.

run("Create Selection");
run("To Bounding Box");
run("Scale... ", "x=0.75 y=0.75 centered");

hope that helps

For your second image it depends on how exactly you want to extract the parts (everything in the inner circle, only outer and inner circle, the inner parts separated by intensity values or all together)?
Could you also post the second image by uploading it, so that we can access it for test processing? it somehow appears to be only a snapshot on the page.

Hi Biovoxxel, thank you for your feedback. The image below shows the circular ROI I would like to extract. I want to perform stats on them (mean, SD etc), then produce a table presenting the data. Whilst for a single image I could define the ROI by their locations manually, in practical use the precise alignment of the phantom will vary from test to test. Therefore ideally I want an algorithm that can find these ROI despite small changes in alignment (deformable registration?).

This cite has many useful images where the high res image can be downloaded

I changed this topic to the “Image Analysis” category since it fits better into it.

Quick question: I use the Recorder to get the Java code which I then convert to jython. I used the macro interpreter to enter your code above, but this does not then write to the Recorder. Is there a straightforward way to convert from the macro language to Java, without the faff of digging through the API? Thanks

To my knowledge you need to quickly run the steps through manually while having the recorder running in java mode, because a macro might not be recordable by the macro recorder itself.

I remember that there might be also a possibility to tell the recorder recording a macro, but don’t remember where this information in my cortex comes from. I’ll see if I can find it.
Potentially, one of the others here might know it right away.

I have another segmentation approach based on KNIME Image Processing.

The workflow (for KNIME Version 3.1) (266.5 KB)iterates over the image until all segments which are bigger than a certain threshold are found.

Here are some result:

On the labels all kind of measurements can be computed with the “Image Features”, “Segment Features” and “Image Segment Features” nodes.


Hi Tim, that is a promising approach, and I have used a similar approach with k-means clustering using python/openCV. Is KNIME available as an imageJ plugin also? I want to keep all of my processing within imageJ since that way my colleagues are most likely to use it. Thanks! Robin

You best bet is to look at how the macro functions are implemented. It is all in In this case

It is a future goal to support executing KNIME workflows from within ImageJ.

However, I wouldn’t let the lack of that feature stop you from trying KNIME. It really is an amazing tool!


Hi I would like to know what is the most efficient way to access the header info in DICOM files. I see there is a class but no examples to get me started. There is also an old plugin which provides the methods I want but appears to be replaced by the aforementioned class
I want to make a script to loop through all the DICOM files in a folder and print out select info from their headers, eg Patiend ID.

Dear Rob,

my group and me have worked some years ago on Image Quality in medical imaging. Based on ImageJ (in fact all image processing of the project is based on ImageJ) we developed a stand-alone Java application Optimage:

The project is open source. While we do not have currently much resource available I would invite you to test it. Some of the things you want to do is implemented already.
The general idea of Optimage is to provide a framework for quality assurance tests in medical imaging. Tests for different modalities are implemented in modules, which can then support different phantom types for the same test (for example different CATPHAN CT phantoms). You can then with a Optimage result generate reports, verify them against reference, tolerance values and so on (it comes with a small database for results).
All test we implemented are based on international norms. The selection of the tests has been made based on the needs in Luxembourg and the available phantoms.

The source code is in the Optimage installer as a seperate “pack”.

Optimage uses to access the DICOM files the TudorDicomTools:

Those library is as well developed in our group.

I hope this information helps you, feel free to contact me in order to get details about those projects.

Best Regards,

1 Like

Dear Andreas
thank you for getting in touch, this package looks very interesting and I
will certainly test it.
Best regards

Hi tibuch I have attempted to reproduce this result but have been unable to as I believe some of the nodes have either been deprecated or function differently now. I replaced the Image Reader but get an error at Filter foreground, which produces an empty data table. Any help greatly appreciated! Cheers

Hi @robmarkcole

Thank you for the hint!

I replaced the workflow with a new version.