Derivative of 2D dose (intensity) image wrt distance

3 views (last 30 days)
I have a 2D image of size M×N representing a radiation dose map with a local dose , where is the spatial coordinate. I want to estimate both derivatives and with respect to r - how do I do that? If neccessary, the spatial resolution is 21 /pixel and isotropic.
Thanks in advance for any help or guidance!

Answers (1)

Aastha
Aastha on 11 Jun 2025
Hi @De Ar,
I understand that you have a 2D image representing a radiation dose map and you want to compute the first and second-order spatial derivatives. You have also mentioned that the spatial resolution is 21 μm/pixel.
To compute the derivatives, you may refer to the steps outlined below:
1. Use the “gradient” function to compute the first-order spatial derivatives using a finite difference approximation. Kindly refer to the MATLAB code snippet below to do so:
delta = 21e-6; % Spatial resolution in meters (21 micrometers)
[dose_dy, dose_dx] = gradient(dose, delta); % Compute gradient components
At each pixel, this returns two values corresponding to the partial derivatives ∂dose/∂y and ∂dose/∂x.
You may refer to MathWorks documentation of “gradient” function for any queries on it:
2. To compute the second-order spatial derivatives, apply the gradient function again to the first-order derivatives. This yields the entries of the Hessian matrix at each pixel:
[d2Iyy, d2Iyx] = gradient(dose_dy, delta); % ∂²dose/∂y² and ∂²dose/∂y∂x
[d2Ixy, d2Ixx] = gradient(dose_dx, delta); % ∂²dose/∂x∂y and ∂²dose/∂x²
These second-order derivatives describe how the gradient itself changes spatially and can be assembled into the Hessian matrix to analyze curvature and local structure.
I hope this helps!

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!