Spleen Segmentation (ม้าม)
This commit is contained in:
parent
2186016f23
commit
6f1241d437
@ -182,7 +182,6 @@ async def spleen_segmentation(file: UploadFile = File(...)):
|
||||
predictor=model, overlap=0.5, mode="gaussian"
|
||||
)
|
||||
|
||||
# ... (Softmax/Sigmoid/Argmax Logic - เหมือนเดิม) ...
|
||||
if prediction_raw.shape[1] > 1:
|
||||
prediction_prob = torch.softmax(prediction_raw, dim=1)
|
||||
segmentation_map = torch.argmax(prediction_prob, dim=1).cpu().numpy()[0]
|
||||
@ -202,11 +201,6 @@ async def spleen_segmentation(file: UploadFile = File(...)):
|
||||
|
||||
spleen_voxels = int(np.sum(segmentation_map == 1))
|
||||
|
||||
# ต้อง Inverse Transform Segmentation Map กลับไปยัง Spacing เดิม
|
||||
# อย่างไรก็ตาม ในการใช้งานจริง มักใช้ Voxel Volume ของ Resampled Image (ซึ่งมี Spacing คงที่)
|
||||
# เนื่องจาก Monai/Inferer มักจะทำการ Resample ก่อน และ Volume Calculation ในงานวิจัย
|
||||
# ส่วนใหญ่จะใช้น้ำหนัก Spacing หลัง Resample แล้ว (target_spacing) เพื่อรักษาความสม่ำเสมอ
|
||||
|
||||
# เราจะใช้ target_spacing เพื่อความสอดคล้องกับ Segmentation Map ที่ได้
|
||||
resampled_voxel_volume_mm3 = float(np.prod(target_spacing))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user