Convert a Group of Dicom Images Into JPGs with Python Using Pydicom and Pillow

  Рет қаралды 5,527

pycad

pycad

Күн бұрын

Hey @pycad ‘s friend
In this video, I will show you how you can use Python to convert a group of Dicom images into JPGs or PNGs so that you can use it in any application you want.
To do that, we will use the same program that we used in the last video which you can find in this link:
bit.ly/3kCOERF
🆕 Learn how to effectively manage and process DICOM files in Python with our comprehensive course, designed to equip you with the skills and knowledge you need to succeed.
www.learn.pyca...
• Subscribe to my newsletter here:
→ bit.ly/3FCMVEW
• You can find the code with some explanation in this link
→ pycad.co/how-t...
• What is an image?
→ pycad.co/what-...
• How to draw on an image in Tkinter
→ pycad.co/how-t...
• Install OpenCV with C++ now in few steps
→ bit.ly/3bGPpVC​
If you have any issue with this, you can leave a comment or you can send me a message on social media using this link.
• Instagram
→ / ​
• Facebook
→ / pycadd​
Here is my Medium profile if you like to read my stories
→ / ​
I edit all my videos using Davinci Resolve, if you want to learn some of the stuff you need for your KZbin or social media videos you can visit my course either on Udemy or Skillshare.
• Udemy
→ bit.ly/3uIjGw6​
• Skillshare
→ skl.sh/32g5U72​
Don't forget to subscribe to support me to do more ☺️
#pycad​ #python​ #computervision

Пікірлер: 25
@pycad
@pycad 2 жыл бұрын
Learn how to effectively manage and process DICOM files in Python with our comprehensive course, designed to equip you with the skills and knowledge you need to succeed. www.learn.pycad.co/course/dicom-simplified
@behrouzrasuli1
@behrouzrasuli1 2 жыл бұрын
THANKS A LOT for your valuable videos
@karimada5309
@karimada5309 3 жыл бұрын
Hello, thank you so much for this video. I have a question if you can help me : my goal is to display on my screen a sequence of 120 DICOM images (MRI images) on only one window and navigate through the images with a scrollbar. Do you think it is possible ? Currently I can open these images but with one window per images (so 120 windows which is not very practical...). I know how to create a scrollbar but I am struggling with associated this scrollbar to the images. Your help would be greatly appreciated ! Thanks in advance
@pycad
@pycad 3 жыл бұрын
Hello, I did a projet similar to what you are looking for, I will tell you what I did if this is the case for you so I can share my github repository with you. I created a tkinter application with a display and some buttons then I could navigate between all the images using those buttons. (The projet contains more stuff) So if you need something like this, juste tell me.
@karimada5309
@karimada5309 3 жыл бұрын
@@pycad This is exactly what I am looking for, that would be really very nice of you if you can share it with me !
@pycad
@pycad 3 жыл бұрын
@@karimada5309 Yeah of course github.com/amine0110/Manual-tumor-segmentation Happy learning
@karimada5309
@karimada5309 3 жыл бұрын
@@pycad Thank you so much for your help !!
@hayetberrah8579
@hayetberrah8579 3 жыл бұрын
Bravooooo😉👍👍👏👏👏👏
@craigcraig6248
@craigcraig6248 Жыл бұрын
Isnt this a just a basic normalization. Dont PACS software do VOI LUTables and histogram analysis?
@pycad
@pycad Жыл бұрын
Hi, Thanks for your comment! Yes, converting DICOM files to JPEG images involves basic normalization techniques. However, my course on DICOM Simplified covers this topic more extensively. If you're interested, you can check out the course here: www.learn.pycad.co/course/dicom-simplified Let me know if you have any other questions or suggestions!
@salsabilbilo8812
@salsabilbilo8812 3 жыл бұрын
ماشاءالله 💓💓
@nandiprachi
@nandiprachi Жыл бұрын
I need a folder with dicom images can anyone help from where I can get em
@pycad
@pycad Жыл бұрын
You can use this one: www.dropbox.com/scl/fi/36nh9huxq49682xvexrxn/case_0009_edited.zip?rlkey=y3ulaonasrp3bvbct4uojnk76&dl=0
@nandiprachi
@nandiprachi Жыл бұрын
Thanks a lot @@pycad !
@prasannalatha4754
@prasannalatha4754 3 жыл бұрын
Hello sir, I am trying to convert a DICOM file consisting of 7,52,803 items. I can able to convert up to 2,95,413. But after that I am getting following error Value Error: The length of the pixel data in the dataset (153710 bytes) doesn't match the expected length (524288 bytes). The dataset may be corrupted or there may be an issue with the pixel data handler. can you please help me to resolve this issue. thanks in advance
@pycad
@pycad 3 жыл бұрын
Hi there, Can you please take one of the images that you couldn't convert and print its data type !
@prasannalatha4754
@prasannalatha4754 3 жыл бұрын
@@pycad actually individually i can able to convert , but as a bunch in one older i cant
@prasannalatha4754
@prasannalatha4754 3 жыл бұрын
@@pycad and the doubt is do there is any memory issue while converting ???
@pycad
@pycad 3 жыл бұрын
@@prasannalatha4754 Please look in this issue, they are having the same problem as you github.com/pydicom/pydicom/issues/1230
@prasannalatha4754
@prasannalatha4754 3 жыл бұрын
@@pycad thanku sir for ur reply, i wil check
@hadjerlaribi8940
@hadjerlaribi8940 3 жыл бұрын
😍😍
@leonsexl5971
@leonsexl5971 3 жыл бұрын
Hi super Video, I wrote your programm in Spyder, a different python interpreter and adapted it to my Path and Database, but I do not get any of the of the filenames in the names List. It returns me [ ] in the console, but I do not understand my issue. Do you know any thing how I could make the programm run?
@pycad
@pycad 3 жыл бұрын
Hi Leon, Can you please send me the lines you are using ! (Exactly what you wrote)
@leonsexl5971
@leonsexl5971 3 жыл бұрын
@@pycad thank you so much for helping me I wrote the following: import numpy as np import pydicom from PIL import Image import os im=pydicom.dcmread('Dicom Bilder/1.dcm') im=im.pixel_array.astype(float) rescaled_image=(np.maximum(im,0)/im.max())*255 final_image=np.uint8(rescaled_image) final_image=Image.fromarray(final_image) def get_names(path): names=[] for root, dirnames, filenames in os.walk(path): for filename in filenames: _, ext= os.path.splitext(filename) if ext in ['.dcm']: names.append(filename) return names print(get_names(r"C:\Users\leons\OneDrive\Bureau\Dicom Bilder\")) def convert_dcm_png(name): im=pydicom.dcmread('Dicom Bilder/'+name) im=im.pixel_array.astype(float) rescaled_image=(np.maximum(im,0)/im.max())*255# float pixels final_image=np.uint8(rescaled_image) final_image=Image.fromarray(final_image) return final_image names=get_names('Dicom Bilder/') for name in names: image=convert_dcm_png(name) image.save(name+'.png')
@pycad
@pycad 3 жыл бұрын
@@leonsexl5971 I made this code for you, it is easier than the other, I am sure it will work for you. PS: please read the comments that I put in the code. gist.github.com/amine0110/124e1ef3efdffef3689b0b54f3a75aee If it doesn't work please let me know, good luck 😊
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Convert GUI App to Real Program -  Python to exe to setup wizard
23:27
Python Simplified
Рет қаралды 570 М.
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 24 МЛН
27 - CLAHE and Thresholding using opencv in Python
20:32
DigitalSreeni
Рет қаралды 23 М.
1. Dicom In Python
22:19
Arbois Code Media
Рет қаралды 32 М.
Convert DICOM Images to PNG, JPG, BMP, GIF
9:15
The Class of AI
Рет қаралды 8 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН