How to read DICOM files Lecture001 - code section

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ส.ค. 2024

ความคิดเห็น • 53

  • @inhibited44
    @inhibited44 6 หลายเดือนก่อน

    if a dcm file has property RescaleIntercept= 0, does that mean their will be no HU plot? your program works for me now and it has a RescaleIntercept= -1024. My own ct scan has a RescaleIntercept = 0, so it seems I will get no HU plot. Thanks for the help

  • @inhibited44
    @inhibited44 6 หลายเดือนก่อน

    Weird error. I extracted both PAL001 and PAL034 to the folder. The program only sees PAL001 - PAL005. Same with PAL034. Len(patient) = 5

    • @lesliewubbel9157
      @lesliewubbel9157  6 หลายเดือนก่อน

      What is your code? Can you share it? In paste bin

    • @inhibited44
      @inhibited44 6 หลายเดือนก่อน

      @@lesliewubbel9157 my mistake I pasted wrong code from that programmer's kaggle site. Thanks it works, but I have my own ct scans and I get an error "AttributeError: 'FileDataset' object has no attribute 'ImagePositionPatient'. Have to look for that issue

    • @inhibited44
      @inhibited44 6 หลายเดือนก่อน

      I inserted
      slices = [dcmread(path + '/' + s) for s in os.listdir(path)]
      print("after slices")
      if slices[0].ImagePositionPatient[2] not in slices[0]:
      print("not in slices")
      return slices # list of DICOM
      and it worked

  • @vovaka440
    @vovaka440 2 ปีที่แล้ว

    Good explanation! Thank you!

  • @inhibited44
    @inhibited44 6 หลายเดือนก่อน

    Once those are read in as .dcm files, are they converted to .pny (numpy) files by converting them using np.array()?

    • @lesliewubbel9157
      @lesliewubbel9157  6 หลายเดือนก่อน

      yes because DICOM files are 3D images and their is information for (x,y,z) you can check the code here pastebin.com/MXkpnAmq or ask chatgpt for help

    • @inhibited44
      @inhibited44 6 หลายเดือนก่อน

      @@lesliewubbel9157 I will check that out. Thanks

  • @faezehshalbafzadeh1931
    @faezehshalbafzadeh1931 ปีที่แล้ว +1

    Thanks!!!

  • @mjhuzamakimin7237
    @mjhuzamakimin7237 2 ปีที่แล้ว

    how to sum pixel values in CT image example in coronal plane have 200 slice how to sum to get 1 slice(image).

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      So I am little confuse by your questions I would not sum the values you would just get one big number.
      But I think you your asking be how to do compile all these "3D slices" into a single 3D image basically you going need to make a new numpy array and then append all the numpy arrays of every slices into that new numpy array.
      I have done this before but I don't know how this helps anyone for analysis. the code is github I have to find it.
      I could make a video for you sometime when I am not working

    • @mjhuzamakimin7237
      @mjhuzamakimin7237 2 ปีที่แล้ว

      @@lesliewubbel9157 thanks you?

    • @mjhuzamakimin7237
      @mjhuzamakimin7237 2 ปีที่แล้ว

      @@lesliewubbel9157 Could you please help me out with code.

  • @ashvinimore8922
    @ashvinimore8922 2 ปีที่แล้ว

    How to check number of missing slices in dicom file

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      Good questions, each file is sequenced or index in the metadata so you could real all files and check the meta data into a array see if there is any missing fiiles

  • @puggyk4220
    @puggyk4220 3 ปีที่แล้ว

    Can u flatten header ?

  • @RaviTeja-zk4lb
    @RaviTeja-zk4lb 2 ปีที่แล้ว

    A Great Tutorial! I have a few doubts in the previous video (what is a DICOM file?) in slide DICOM Caveats Encoding slide at last. It is mentioned that the pixel_array contains HU values. But here in code why are you converting them to HU values?

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      The default values you extract are in binary and you have convert to HU. HU is just the way radiologist discuss the scale of grayness instead saying binary. Because they dont learn that in class they learn that CT images exist on HU scale.

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      Sorry I didn't answer the question, the reason you convert HU values is because it makes the data comparable from CT machine to the Next CT machine. Different brands of CT machines have different resolutions depending when they were manufacturing this is effected by many factors, material, voltage, equipment etc All you need the know the newer CT machines have higher resolution and older machines have lower resolution and this is why you need to convert to HU to even compare that data lets say in a machine learning model.

  • @nazilaameli8639
    @nazilaameli8639 2 ปีที่แล้ว

    Thanks for perfect tutorial.
    I try the code and get this error :InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header. Use force=True to force reading.
    how it can be fixed?

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      Yup so the dicom file itself is missing data that the code is using. That means the dicom file you have if you just read it out to plain text is missing information. Its missing data which makes sense sometimes because medical data is scrubbed of personal information. So dicom data structure is composed of header and you will have to debug it yourself and make python try/except for the missing tag in dicom data

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว +1

      Simply solution is the function dcmread(force=True) it tells the function to read the file anyway since its missing the 'DICM' tag

    • @nazilaameli8639
      @nazilaameli8639 2 ปีที่แล้ว

      @@lesliewubbel9157 thanks for the reply. I added the function and it worked but now, I get another error that I have no idea about. I have the folder of my Dicom slices in my drive but it shows that [Errno 21] Is a directory: '/content/drive/MyDrive/Nazila cases 1-20/pt 1/.ipynb_checkpoints'

  • @vairoalexnder
    @vairoalexnder 2 ปีที่แล้ว

    what is the version of matplotlip,pyplot you are using ???

  • @pavithramuthukumar3802
    @pavithramuthukumar3802 3 ปีที่แล้ว +1

    Thankyou

  • @c.e.g.o4797
    @c.e.g.o4797 2 ปีที่แล้ว

    Thank you, bro ;)

  • @sadafhajiha948
    @sadafhajiha948 2 ปีที่แล้ว

    Hello. Thanks for the explanation. In the very beginning, when I try to activate the virtual environment, I face with this error :zsh: command not found: .test_envScriptsactivate
    I have python installed on my visual studio, so I cant understand what the problem might be. Could you please help?

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      what command are you using? and whats your operating system?

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      .test_envScriptsactivate did you not use .test_env\Script\activate

    • @sadafhajiha948
      @sadafhajiha948 2 ปีที่แล้ว +1

      @@lesliewubbel9157 I am using mac. And yes, i used .\test_env\Script\activate

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      @@sadafhajiha948 so when you use mac to enter a virtual environement you do
      source ./test_env/bin/activate
      macOS is built on top of UNIX so it refers to scripts as bin for binary

  • @nimeshkumar3663
    @nimeshkumar3663 2 ปีที่แล้ว

    Hi, i want to read dicom in nodeJS and convert it into Png. Can you please share resource or anything which can be helpful to me

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      Hey Nimesh github.com/cornerstonejs/dicomParser try this github link also it be good to try googling some solutions? I don't know if you mean produce a video for that or not

    • @nimeshkumar3663
      @nimeshkumar3663 2 ปีที่แล้ว

      @@lesliewubbel9157 if you can make a video then that would be great,I did looked at the link you have provided but i am not able to convert dcm to other image formats

    • @lesliewubbel9157
      @lesliewubbel9157  2 ปีที่แล้ว

      @@nimeshkumar3663 i cannot promise that i will get to it, it takes lot work and testing

  • @puggyk4220
    @puggyk4220 3 ปีที่แล้ว

    Hello when will you make video of anonymize/ large scale process ; pyspark

    • @lesliewubbel9157
      @lesliewubbel9157  3 ปีที่แล้ว +1

      not for while its kinda low on the too list. I will show how to anonymize soon but not large scale process that is in-depth technical development its time consuming not really worth making a tutorial

    • @puggyk4220
      @puggyk4220 3 ปีที่แล้ว

      @@lesliewubbel9157 okay sir

  • @ws3457
    @ws3457 3 ปีที่แล้ว

    How do we store this data in sqlite3 or another db?

    • @lesliewubbel9157
      @lesliewubbel9157  3 ปีที่แล้ว

      it depends you could write some SQL inserts in python code and you have to convert all dicom files to binary. I dont really know of more efficient way there's lot going on about file compression that can make uploading more efficient again it just complicate like reading documents and testing a project like that. its not impossible just difficult and time-consuming on your own.
      What your goal?

    • @ws3457
      @ws3457 3 ปีที่แล้ว

      @@lesliewubbel9157 My goal is to take the metadata attributes(not the files themselves) from the python code you have shown (which is great) and store that data in sql.

    • @lesliewubbel9157
      @lesliewubbel9157  3 ปีที่แล้ว

      @@ws3457 that wont be hard it's very doable if you ever interested learning more we working on open source community we are always happy to talk or work together

    • @ws3457
      @ws3457 3 ปีที่แล้ว

      @@lesliewubbel9157 Yes, I would like that. Please let me know how to join.

    • @lesliewubbel9157
      @lesliewubbel9157  3 ปีที่แล้ว

      @@ws3457 we use discord discord.gg/X9yKUDU5