Gail Distefano asked . 2024-01-02

How to compare contours?

In the attached file is a matrix of dose_data for a piece of radiographic film I have irradiated, and respective x and y coordinates for the film.
 
I can plot specific dose lines (11Gy,12.1Gy), and then plot a circle (representing a tumour) centre 0,0 and radius 5.
 
contour(col_scale,row_scale,dose_data,[11,12.1]);
hold on;
ROI1= drawcircle('Center',[0,0],'Radius',5,'StripeColor','red');
 
 
I would like to be able to compare for example the 11Gy isodose line and the circle (tumour) to see how well it was irradiated. For example getting a DSC or % area of circle covered by the 11Gy dose contour. I have tried different Matlab functions but my data is not in the correct data type/format. Any advice on how to do this would be much appreciated.

image analysis , roi comparison , Surfaces, Volumes, and Polygons Volume Visualization , Vector V

Related Questions

Expert Answer

Kshitij Singh answered . 2024-12-21 16:44:49

To what I understand. There maybe other ways to achieve desired results:
 
To compare the 11 Gy isodose line with the tumour circle (ROI) and compute metrics like the Dice Similarity Coefficient (DSC) or the percentage of the circle covered by the 11 Gy dose contour, you'll need to perform several steps. First, you'll need to create binary masks of the isodose line and the circle, then compare these masks.
  1. Create a Grid: Use meshgrid to create a grid of x and y coordinates corresponding to your dose_data matrix.
  2. Generate Binary Masks: Create binary masks where the pixels within the 11 Gy isodose line and within the tumour circle are 1, and all other pixels are 0.
  3. Calculate the Intersection: Find the intersection of the binary masks to see which pixels are within both the isodose line and the circle.
  4. Calculate the DSC: The DSC is calculated as 2 * (|A ∩ B|) / (|A| + |B|), where A and B are the binary masks of the two regions, and |A ∩ B| is the count of pixels in the intersection.
  5. Calculate the Percentage Area Covered: The percentage of the circle covered by the 11 Gy dose contour is the number of pixels in the intersection divided by the number of pixels in the circle mask.

 

% Assume col_scale and row_scale are vectors that scale the matrix indices to your physical coordinates.

[x, y] = meshgrid(col_scale, row_scale);

% Binary mask for the 11 Gy isodose line
isodose_11Gy_mask = dose_data >= 11;

% Binary mask for the circle (tumour)
% This is a logical operation to create a binary mask of the circle.
circle_mask = ((x.^2 + y.^2) <= 5^2);

% Find the intersection of the isodose line and the circle
intersection_mask = isodose_11Gy_mask & circle_mask;

% Calculate Dice Similarity Coefficient (DSC)
DSC = 2 * nnz(intersection_mask) / (nnz(isodose_11Gy_mask) + nnz(circle_mask));

% Calculate the percentage area of circle covered by the 11 Gy dose contour
percent_coverage = nnz(intersection_mask) / nnz(circle_mask) * 100;

% Display the results
disp(['DSC: ', num2str(DSC)]);
disp(['Percentage of Circle Covered by 11 Gy Contour: ', num2str(percent_coverage), '%']);
This code assumes that col_scale and row_scale are defined such that they scale the matrix indices of dose_data to the corresponding physical coordinates of your film.
 
Please replace the placeholder operations with the appropriate variables and operations from your actual data and setup.
 
Make sure that the x and y coordinates in the meshgrid correctly represent the physical positions on your film. If your dose data is very large or if the contour function doesn't return a binary mask directly, you might need additional processing to convert the contour lines into a binary mask.


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.