dicom2
test
https://book.orthanc-server.com/plugins/worklists-plugin.html#worklists-plugin
https://github.com/sscotti/python_script_library
https://book.orthanc-server.com/plugins/python.html#handling-worklist-scp-requests-new-in-3-2
https://github.com/bjoernalbers/mowoli
python create mwl
https://github.com/opendicom/opendicomMWLpy
https://stackoverflow.com/questions/71015541/is-there-a-python-dicom-modality-worklist-setup-library
dcmdump wklist1.wl > sample-worklist.txt
dump2dcm sample-worklist.txt sample-worklist.wl
https://groups.google.com/g/orthanc-users/c/6ygCGjhDrsA
python file
import json
import orthanc
def OnChange(changeType, level, resource):
if changeType == orthanc.ChangeType.ORTHANC_STARTED:
print('Started')
mwlquery = dict()
mwlquery["AccessionNumber"] = '00007'
MWL = orthanc.RestApiPost('/modalities/PACS1/find-worklist', json.dumps(mwlquery))
print(MWL)
orthanc.RegisterOnChangeCallback(OnChange)
Json file
Plugins:
0: "/home/jodogne/orthanc-python/Build"
1: "/home/jodogne/orthanc/Build"
PythonScript: "scotti.py"
DicomModalities:
PACS1:
0: "ORTHANC"
1: "localhost"
2: 4242
Worklists:
Enable: true
Database: "/home/jodogne/orthanc/OrthancServer/Plugins/Samples/ModalityWorklists/WorklistsDatabase"
------------
Using Orthanc Worklist Plugin
Orthanc server has worklist plugin1 which will serve worklist files that are stored in a particular directory. Let us download sample worklist files from Orthanc repository and keep in "WorklistDatabase" directory.
Generate default configuration by running the following command.
$ ./Orthanc --config=config.json
In the orthanc configuration file, enable worklist plugin, specify the worklist database directory so that Orthanc can locate relevant worklist files, add required modalities and restart the server.
"Plugins" : [
"libModalityWorklists.dylib"
],
"Worklists" : {
"Enable": true,
"Database": "./WorklistsDatabase",
"FilterIssuerAet": false,
"LimitAnswers": 0
},
"DicomModalities" : {
"PYNETDICOM" : ["PYNETDICOM", "127.0.0.1", 4243],
"FINDSCU" : ["FINDSCU", "127.0.0.1", 4244]
}
Once the plugin is enabled, we can use findscu to send C-FIND query.
$ findscu -W -k "ScheduledProcedureStepSequence" 127.0.0.1 4242
This will retrieve all worklist files from the server.
Using wlmscpfs
dcmtk 2 is a collection of utilities for DICOM standard. It has wlmscpfs application which implements basic Service Class Provider(SCP). We can start the service by running the following command.
wlmscpfs --debug --data-files-path WorklistsDatabase 4242
Once the service is started modalities can send C-FIND query to this service.
Conclusion
We have seen how to setup MWL SCP using Orthanc & wmlscpfs. Now that we have PACS & WML SCP up and running, in the next article lets see how to dig deeper in to the dicom standard.
---------------------
https://www.findbestopensource.com/product/janpipek-pydiq
https://github.com/janpipek/pydiq
https://github.com/wenyalintw/Dicom-Viewer ยังเเปิดได้แต่ PNG
https://github.com/josvromans/imageviewer/tree/3860e96e27edfb551077d6b216698ad7bd9aea9a เปิดได้แต่ jpg
https://morphuslabs.com/how-i-got-into-hacking-ultrasound-machines-part-02-3b16b799974c
ระบบ PACS (Picture Archiving and Communication System) [4]
PACS คือระบบที่ใช้ในการจัดเก็บรูปภาพทางการแพทย์ (Medical Images) หรือภาพถ่ายทางรังสี โดยมีการรับส่งข้อมูลภาพในรูปแบบดิจิตอล PACS ใช้การจัดการรับส่งข้อมูล ผ่านทางระบบเครือข่ายคอมพิวเตอร์ โดยการส่งภาพข้อมูลตามมาตรฐาน DICOM ระบบ PACS จะช่วยให้แพทย์ได้รับภาพถ่ายทางรังสีและผลวิเคราะห์จากรังสีแพทย์อย่างรวดเร็ว ทำให้แพทย์วินิจฉัยโรคและให้การรักษาผู้ป่วยได้เร็วยิ่งขึ้น โดยเฉพาะผู้ป่วยหนัก นอกจากนี้ ปัญหาการจัดเก็บและค้นหาฟิล์มเอกซเรย์ ก็ทำให้เกิดความล่าช้าของการรายงานผลเอกซเรย์ได้ บางครั้งเราอาจจะพบว่ามีการสูญหายของฟิล์มเอกซเรย์ ซึ่งมีความจำเป็นในการใช้เปรียบเทียบการเปลี่ยนแปลงของโรค ระบบ PACS มีการจัดเก็บข้อมูลไว้ในคอมพิวเตอร์ซึ่งมีระบบเก็บข้อมูลสำรอง จึงช่วยแก้ปัญหานี้ได้
ข้อสังเกต DICOM file
- DICOM files are not recognized by Windows® as image files ดังนั้น เราไม่สามารถเปิดไฟล์โดยใช้ software หรือ application ทั่วไปได้ [2]
- ในการจะเปิดดูไฟล์ จำเป็นต้องใช้ additional software package called “DICOM browser” เช่น 3D-Doctor Viewer v 4.0.070803, DCM View etc. [3]
- รูปภาพที่แสดงจะประกอบไปด้วยจุดจำนวนมาก เรียกแต่ละจุดนี่ว่า “pixels” ซึ่งจำนวน pixels นี่ก็ขึ้นอยู่กับ ชนิดของ Digital medical image ที่เราใช้ เช่น ถ้าเป็นของ CT scan จะเป็น 512 x 512 pixels ขณะที่ของ MRI จะเป็น 256 x 256 pixels โดยพื้นที่ในการจัดเก็บ และ Resolution ของ Digital image ต่างๆ เป็นไปตามตารางนี้ [2]
Computer tomography (CT)
หลักการ [5]
- เป็นการปล่อย X-ray ลำแคบๆ กระทบตัวผู้ป่วยและเก็บภาพโดย Detector โดยที่จะมีการเก็บข้อมูลในมุมที่ต่างๆ กัน และนำข้อมูลที่ได้ไปประมวลผลโดย Computer เพื่อแปรผลภาพออกมาในมุมและระนาบที่ต้องการ
- ปัจจุบันได้มีการพัฒนาขึ้นโดยให้มีการฉาย X-ray เป็นรูปพัด โดยที่มี Detector เรียงตัวเป็นวงกลมโดยรอบและมีเพียงหลอด X-ray เท่านั้นที่หมุนรอบตัวผู้ป่วย
ลักษณะการสแกน
1. Single scan CT สแกนเป็น Shot
2. Spiral CT สแกนต่อเ้นื่องเป็นวง
Density
ในภาพ CT นั้นจะได้ออกมาเป็น Grayscale Picture ซึ่งมีเฉดสีเทาที่สามารถแยกได้หลายระดับ โดยที่จะวัดหน่วยเป็น Hounsfield unit (HU) ซึ่งมีตั้งแต่ -1000 HU ไปจนถึง +1000 HU โดยมีรายละเอียดคร่าวๆ ดังนี้
Air < -500 HU ดำสุด
Fat < -90 HU
Water & CSF 0 HU
Hematoma 50–90 HU
Calcification > +80 HU
Bone > +500 HU ขาวสุด
What is a Hounsfield unit or CT number? [6][10]
The unit of measurement in CT scans is the Hounsfield Unit (HU), which is a measure of radiodensity. The range of CT numbers is 2000 HU wide although some modern scanners have a greater range of HU up to 4000. Each number represents a shade of grey with +1000 (white) and –1000 (black) at either end of the spectrum. (note: the upper limit is determined by the scanner type). [12]
Axial computed tomography (CT) image with sample typical CT numbers in HU. CSF, cerebrospinal fluid. [11]
Display Parameter [5]
หน่วยที่ใช้วัดความหนาแน่น(ความเข้ม)ของอวัยวะต่างๆในร่างกายจากภาพ CT image คือ Hounsfield Unit โดยมีความกว้างของหน่วยตั้งแต่ -1,000 ไปจนถึง +1,000 ซึ่งทำให้สามารถแสดงเฉดสีเทาที่แตกต่างกันออกไปได้มากถึง 2,000 เฉด แต่เนื่องจากความสามารถทางกายภาพ หรือตาของมนุษย์ไม่สามารถจะแยกแยะความแตกต่างได้มากขนาดนั้น จึงจำเป็นต้องกำหนดกรอบเฉพาะ ช่วงค่าที่เราสนใจ เพื่อให้แพทย์สามารถแปลผลได้ดีขึ้น โดยการปรับ Parameter 2 ตัวนี้
1. Window Level (WL)
เป็นค่าที่ใช้ระบุค่าสีเทากลางของภาพ ว่าต้องการให้มีการแสดงผลที่ระดับความเข้มใดเป็นหลัก เช่น ถ้าหากต้องการที่จะดูส่วนที่เป็นกระดูก ก็ควรตั้งค่าให้สูงในช่วงระดับของความเข้มระดับของกระดูก ( เช่น 700 HU เป็นต้น)
2. Window Width (WW)
เป็นการระบุค่าความกว้าง หรือ Range ที่ต้องการให้มีการแสดงผลระดับเฉดสีเทานั้นๆ ซึ่งจะยึดจากค่า Level เป็นหลัก ว่าต้องการค่ากว้างเท่าใด (ตัวอย่างเช่น Level = +700 HU และ Window = 200 HU จะทำให้มีการแสดงผลเฉพาะช่วง +600 ถึง +800 เท่านั้น)
****** หมายเหตุ : ตัวเลขในหัวข้อนี้เป็นเพียงการสมมติให้เข้าใจได้ง่ายขึ้นเท่านั้น ไม่ควรยึดติดเป็นตัวเลขที่ใช้จริง ******
หมายถึง สารที่ใช้ในการตรวจทางรังสีวิทยา เพื่อให้เกิดความแตกต่างในการดูดกลืนรังสีระหว่างอวัยวะที่ต้องการตรวจกับอวัยวะหรือโครงสร้างอื่นที่อยู่ใกล้เคียง เป็นผลให้เห็นอวัยวะที่ต้องการตรวจได้ชัดเจนขึ้น ซึ่งสามารถนำเข้าสู่ร่างกายได้หลายทาง เช่น การรับประทาน , การสวนเข้าทางทวารหนัก และฉีดเข้าหลอดเลือด หรือเข้าช่องโพรงของร่างกาย (จามรี, 2538 : ชรินทร์, 2542 : สมเกียรติ, 2538)
สารทึบรังสีชนิดฉีดเข้าหลอดเลือด เป็นสารที่มีความจำเป็นในการแยกความแตกต่างของอวัยวะที่ต้องการตรวจกับอวัยวะที่อยู่ใกล้เคียง ทั้งนี้เพื่อช่วยให้ภาพจากการตรวจทางรังสีมีความชัดเจนมากขึ้น ดังนั้นสารทึบรังสีจึงเข้ามามีบทบาทในการตรวจทางรังสีหลายชนิด ได้แก่ การตรวจเอกซเรย์คอมพิวเตอร์ ( CT ), การตรวจดูการทำงานของไต (Intravenous pyelography ), การถ่ายภาพรังสีหลอดเลือด ( Angiography / Venography ), การตรวจด้วยคลื่นแม่เหล็กไฟฟ้า ( MRI )
การตรวจ CT จำเป็นต้องมีการใช้สารทึบรังสี (iodinated contrast medium; ICM) เพื่อช่วยในการแยกแยะพยาธิ สภาพออกจากอวัยวะปกติภายใน CNS โดยเฉพาะ โรคของหลอดเลือด เนื้องอกและการติดเชื้อ ICM มี หลายชนิดและมีวิธีการให้ขึ้นอยู่กับข้อบ่งชี้ในผู้ป่วย แต่ละราย [9]
สำหรับคนที่กำลังจะเริ่มทำ Deep learning on CT image ผมแนะนำลองไปติดตามอ่าน Blog ของ ThaiKeras ตาม Link นี้เลยครับ เพื่อเป็นแนวทางในการ prepare data ก่อน จะ feed เข้า Model ครับ
Ref:
1. https://sites.google.com/site/medicaldigitalimage/home/digital-image-distribution-and-networks/dicom
2. Varma DR. Managing DICOM images: Tips and tricks for the radiologist. The Indian journal of radiology & imaging. 2012 Jan;22(1):4.
3. Varma DR. Free DICOM browsers. The Indian journal of radiology & imaging. 2008 Feb;18(1):12.
4. https://med.mahidol.ac.th/sdmc/th/technology/PAC-th
5. http://ventangelo.blogspot.com/2010/10/principle-of-ct-and-mri.html
6. https://web.archive.org/web/20071129085332/http://www.intl.elsevierhealth.com/e-books/pdf/940.pdf
7. https://oncologymedicalphysics.com/ct-basic-operations/
8. https://www.vibhavadi.com/health186
9. https://thaistrokesociety.files.wordpress.com/2017/05/09-iodinated-contrast-medium_30-03-60.pdf
10. https://towardsdatascience.com/medical-image-analysis-with-deep-learning-9557cad44944
11. https://www.sciencedirect.com/topics/medicine-and-dentistry/hounsfield-scale
12. https://www.startradiology.com/the-basics/x-rayct-technique/