Climbing the Laravel learning curve

After checking out several different PHP frameworks, I settled on using Laravel for redoing the x-ray equipment tracker that I use at work. It’s been a TODO project on my list for quite a while now and for the past couple of months, I’ve been studying the Laravel docs, writing up the redesign of my project and trying to put together some code.

I’ve managed to learn how to use Laravel enough to implement some simple tasks such as displaying lists of the x-ray units stored in the database. It’s actually been surprisingly easy, and I haven’t really had to write a whole lot of code. For the simple tasks that I’ve implemented so far, Laravel has done most of the heavy lifting. I just write the code to say what I want and how to display it, and Laravel does the rest.

So far most of the work I’ve had to do was in redoing the database schema to match the conventions used by Laravel’s Eloquent ORM. That mostly involved renaming tables and indexes, and trying to figure how to define the relationships in the model files.

Still have lots of learning and work to do, but I’m making progress. Baby steps.

Project idea: Half value layer comparisons

Two of the non-invasive meters I use at work can measure everything I need in a single shot: kV, exposure, exposure time, filtration, half value layer (HVL).

Even though the meters will calculate the HVL of the x-ray beam for me from one exposure, I still measure it with different thicknesses of aluminum and calculate the HVL. Just from first order impressions of using the meters over the years, I always felt that the HVL determined by the meter was never as accurate as doing the actual measurement.

It’s not anything I’ve ever tested or looked closely at though. With all the HVL data I have from the past few years, I can take a closer look at how the meter HVL and my calculated HVL compare. There’s at least a couple of years worth of HVL as a function of kV, so a plot of HVLmeter vs HVLcalc should give me a straight line with a slope of 1 if the meter HVL is useful.

I’ll need to go back to my spreadsheets and extract the meter derived HVLs and collect the corresponding measured HVL so it could be a while before I find a big enough chunk of free time to do that.

If it turns out the meter derived HVL is close to my calculated HVL, that means I could probably modify my data acquisition and do my testing with fewer exposures.

Radiation output from radiographic units

This is the average x-ray output (μGy/mAs at 40″) measured on ~40 radiographic units (fixed and portable units) over about 3 years for both large and small focal spots.

Radiation output (μGy/mAs) at 40
Radiation output (μGy/mAs) at 40″

Textbooks say the radiation output should be proportional to kV2. Fitting a power law curve to the data gives the equation

Output (μGy/mAs) = 0.008373*kV1.983

which is pretty darn close to the expected square law.

There’s not as much variation as might be expected. Armed with this data, I think I’d be comfortable calculating exposure estimates for patients or image receptors for any radiographic unit.

Half Value Layers

The many years of x-ray equipment testing I’ve done has generated a lot of potentially useful data on the performance of imaging equipment that I lay hands on.

In the past, I’ve just measured the half value layer (the thickness of material required to reduce the x-ray beam intensity by one half) of the x-ray beam at one point: 80 kVp. A couple years ago, I decided to add 60, 100 and 120 kVp to satisfy my curiosity. I knew from testing mammography machines that HVL was pretty linear between a narrow range of kV (24-32). Turns out over the much wider range of 60-120 kVp, HVL is still pretty linear. This is close to 3 years worth of HVL data from almost 40 radiographic units (fixed and portable).

Half value layer vs kV
Half value layer vs kV

Below is the mean HVL as a function of kV. Error bars represent the standard deviation at each kV. The linear fit equation is

HVL = -0.0254 + 0.03868*kV
Mean half value layer vs kV

The histograms below show the spread in HVLs measured at each kV.

Half value layer histograms at each kV

There doesn’t seem to be any significant trend over time (which is what I would expect). Here I’m using the ID assigned to each survey as a surrogate for time.

Half value layer by survey  ID

A moderately interesting finding I think. One thing that might be interesting to see is how HVL changes with the type of machine (fixed room vs portable). I’d have to go back to my spreadsheets and recollect the data to add in the type of machine though. Not sure I’m curious enough about it to go through all that again, but perhaps.

Focal spot image artifact

When the focal spot of an x-ray tube needs to be evaluated, the usual method is to use a slit or pinhole. The slit camera is typically made from two pieces of tungsten or other dense material arranged so that there’s a very small gap between the two, typically 0.1 mm wide or smaller. Place the slit camera up against the collimator and make an exposure. The resulting image is a line that represents the detected radiation from the focal spot. Given the distance from the focal spot to the camera and to the image receptor, the size of the focal spot can be calculated from the width of the line. Turning the slit camera 90° and acquiring a second image gives the focal spot dimension in the other axis.

The pinhole camera works in much the same way, except using a very small hole instead of a slit. You also get an image of the actual focal spot itself and can measure both dimensions of the focal spot directly. It’s the same as using a pinhole camera for visible light pictures.

A long time ago, I learned that if you don’t have a pinhole camera, you can sort of fake it by closing the collimator blades almost all the way down until you can see just a pinprick of light when the light field is turned on. Since it can be difficult to know the distance between the hole and the focal spot, doing quantitative measurements of the focal spot isn’t easy, but it can be useful for demonstration purposes, to show a class of rad tech students or residents.

Every now and then, you get focal spot images showing up in images unintentionally, like in this image from a portable x-ray unit I was testing the other day

The double band (double banana) is characteristic of most focal spot images taken with a pinhole camera. A normal pinhole image of a focal spot is dark in appearance, but this artifact is lighter than the surroundings.

The most likely source of the artifact is a tiny dense particle, probably a metal shaving or something similar, that’s landed near the x-ray tube window or in the collimator housing somewhere. The metal shaving is dense enough to absorb some of the radiation, acting as kind of a “reverse pinhole”, producing a light pinhole image instead of a dark one.