Borrar filtros
Borrar filtros

Plotting alone a circle with 3ddose data

3 visualizaciones (últimos 30 días)
Maryam Rahbaran
Maryam Rahbaran el 15 de Abr. de 2022
Respondida: Anurag el 25 de Oct. de 2023
Hello,
I have a 3ddose file that I am plotting, but I want to just get the data points along an arbitrary circle. I tried to define a circle with x y and z in spherical coordinates with the cm values from the 3ddose files and also tried doing this with index values but I can't seem to find a way to actually get the indices to then make a dose plot. Is this possible to do, and if so, what is the best way to do so?

Respuestas (1)

Anurag
Anurag el 25 de Oct. de 2023
Hi Maryam,
I understand that you want to extract data along a circle from your 3ddose file. Please refer to the following steps to do the same:
  • You need to define the parameters of the circle in 3D space. These parameters include the center of the circle, the normal vector to the circle's plane, and the radius of the circle.
  • Generate a set of points that lie on the circle in 3D space. You can do this by parametrically varying the angle around the circle and using trigonometric functions to calculate the corresponding points on the circle.
  • For each point on the circle, you need to convert its Cartesian coordinates to the corresponding indices in the 3D dose matrix.
  • Using the indices obtained in the previous step, you can extract the dose values from the 3D dose matrix.
  • Finally, you can plot the dose values along the circle to visualize the dose profile.
Here is a sample code for your reference.
% Define parameters of the circle (center, normal vector, and radius)
center = [x0, y0, z0]; % Center coordinates
normal_vector = [nx, ny, nz]; % Normal vector to the circle's plane
radius = r; % Radius of the circle
% Generate points on the circle
num_points = 100; % Adjust as needed
theta = linspace(0, 2*pi, num_points); % Angle values
circle_points = center + radius * (cos(theta) * nx + sin(theta) * ny);
% Convert circle points to indices
indices = round((circle_points - origin) ./ voxel_size) + 1; % Adjust for MATLAB's 1-based indexing
% Extract dose values along the circle
dose_profile = zeros(num_points, 1);
for i = 1:num_points
dose_profile(i) = dose_matrix(indices(i, 1), indices(i, 2), indices(i, 3));
end
% Plot the dose profile
plot(theta, dose_profile);
xlabel('Angle (radians)');
ylabel('Dose');
title('Dose Profile Along the Circle');
Hope this helped.
Regards,
Anurag

Categorías

Más información sobre FPGA, ASIC, and SoC Development en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by