Dice Similarity Coefficient with STL File Input

조회 수: 5 (최근 30일)
neruk41
neruk41 2021년 3월 12일
답변: Rahul 2025년 5월 12일
Hello,
I have two segmented files in STL format. I need to input them into MATLAB and then perform an analysis on them to obtain a Dice Similarity Coefficient (DSC). Can MATLAB even take in STL file inputs? If so, how does it do this and how would I then use them to perform a DSC analysis? I see that MATLAB has the dice() function. Any help would be appreciated!

답변 (1개)

Rahul
Rahul 2025년 5월 12일
I understand that you wish to read the stl files in MATLAB and then perform analysis to obtain the Dice Similarity Coefficient (DSC). You can consider the following steps:
  • Use the 'stlread' function to read the stl files into MATLAB.
  • Since this stl data cannot be directly used to calculate DSC, obtain a logical mask of the stl data using 'VOXELISE' and 'logical' functions. Note: VOXELISE is provided by a MATLAB File Excahnge Submission.
  • Now to evalue the DSC, use the 'dice' function.
Here is a small example:
fv1 = stlread('file1.stl');
fv2 = stlread('file2.stl');
voxelSize = [128, 128, 128]; % Choose appropriate resolution
mask1 = VOXELISE(voxelSize(1), voxelSize(2), voxelSize(3), 'file1.stl', 'xyz');
mask2 = VOXELISE(voxelSize(1), voxelSize(2), voxelSize(3), 'file2.stl', 'xyz');
% Note: Download VOXELISE from MATLAB File Exchange and add to path
mask1 = logical(mask1);
mask2 = logical(mask2);
dsc = dice(mask1, mask2);
The following MathWorks documentations and File Exchange submission can be referred:
Thanks.

카테고리

Help CenterFile Exchange에서 STL (STereoLithography)에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by