Skip to main content

scaf — Structural Conservation Adaptive Flow: Physics-based medical imaging reconstruction

Project description

SCAF — Structural Conservation Adaptive Flow

PyPI version License: MIT Tests: 322/328 Zero GPU

قانون فيزيائي واحد. سبعة منتجات. 322 اختبار موثق. صفر GPU.


المبدأ الأساسي

C  = sum(x) / mean(mask)     # ثابت الحفاظ
Ec = |sum(x*) - C| → 0      # خطأ الحفاظ

أي إشارة فيزيائية حقيقية تحفظ مجموع طاقتها. SCAF يحوّل هذا القانون إلى خوارزمية بسيطة تعمل على 7 مجالات طبية.


التثبيت

pip install scaf-medical

مع كل الاعتماديات:

pip install scaf-medical[full]

الاستخدام السريع

SCAF-Inverse — تحسين MRI

import numpy as np
from scaf import SCAFInverse

# kspace: 2D complex array من جهاز MRI
# mask:   2D binary array (1=مقاس، 0=مفقود)
recon  = SCAFInverse()
result = recon.reconstruct(kspace, mask)

# قياس الجودة
snr = recon.snr(reference, result)
print(f"SNR: {snr:.2f} dB")

SCAF-Video — إصلاح فيديو القلب

from scaf import SCAFVideo

# frames:    [T, H, W] — الإطارات (المفقودة = أصفار)
# drop_mask: [T] bool  — True = مفقود
fixer   = SCAFVideo()
repaired = fixer.repair(frames, drop_mask)

SCAF-Guard — كشف هلوسة AI

from scaf import SCAFGuard

guard  = SCAFGuard(threshold=0.05)
result = guard.verify(ai_output, reference_input)

print(result['verdict'])            # PASS / WARNING / FAIL / CRITICAL
print(result['is_hallucination'])   # bool
print(result['confidence'])         # 0.0 - 1.0

SCAF-Cert — شهادة جودة رياضية

from scaf import SCAFCert

cert = SCAFCert()
certificate = cert.certify(reconstructed_image, mask)

print(certificate['verdict'])       # CERTIFIED / WARNING / FAIL
print(certificate['bound_l2'])      # الحد الأعلى لخطأ L2
print(certificate['bound_snr_db'])  # الحد الأعلى لخطأ SNR

SCAF-SORL — تحسين الصور العامة

from scaf import SCAFSORL

enhancer = SCAFSORL()
enhanced = enhancer.enhance(image)

النتائج الموثقة

المنتج الاختبارات النجاح SNR Gain الميزة
SCAF-Inverse 90/90 100% +1.94 dB #1 على 4x Random
SCAF-Video 120/120 100% +1.47 dB كل معدلات الفقدان
SCAF-Guard 6/6 100% +4.36 dB لا مثيل له
SCAF-Cert 90/90 100% مضمون بدون ground truth
SCAF-SORL 3/3 100% +2.16 dB عام

مقارنة SCAF-Inverse مع المنافسين (4x Random — M4Raw)

الطريقة SNR (dB) GPU تدريب شهادة خطأ
SCAF-Inverse v2 15.028 لا لا
BM3D+DC 14.175 لا لا
NLM+DC 14.100 لا لا
TV+DC 13.692 لا لا
Deep Learning ~14.2 ✅ نعم ✅ ملايين صور

المعاملات المقفلة

beta  = 2.42   # قوة الانتشار  — ثابت عبر كل المجالات
dt    = 0.05   # الخطوة الزمنية — ثابت عبر كل المجالات
kappa = 0.22   # عتبة الحواف  — يتغير قليلاً بين المجالات

الاختبارات

pip install scaf-medical[dev]
pytest scaf/tests/ -v

الاقتباس

@software{scaf2025,
  title  = {SCAF: Structural Conservation Adaptive Flow},
  author = {SCAF Research Laboratory},
  year   = {2025},
  url    = {https://github.com/scaf-lab/scaf},
  note   = {322 validated tests, 98.2\% success rate}
}

الترخيص

MIT License — مجاني للاستخدام البحثي والتجاري.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scaf_lab-1.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scaf_lab-1.0.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file scaf_lab-1.0.0.tar.gz.

File metadata

  • Download URL: scaf_lab-1.0.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for scaf_lab-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e7d01fc7a263ef57830eb5e5ebc6bc5c60e7c9e8c6e372ae6cbd884219c2789a
MD5 a9c8d7cb7e8ec2941c265e5a78b156e5
BLAKE2b-256 bee49ee5d87e477413007f52725123493d9a02ad5309c00f62d60bad5117943e

See more details on using hashes here.

File details

Details for the file scaf_lab-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: scaf_lab-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for scaf_lab-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7a05c163541d8946d0698d7923f56bb1b2d1c0fd4024168879ca4c98147943
MD5 f623022c5f3fcd8a0061c6d4f9bf70b1
BLAKE2b-256 0b3e1de065212791d8e48fb6628c3f25951504dedc8a3a16cb914391ac4b48b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page