How display a dicom image in pymt
Posted: 01 December 2010 10:00 PM   [ Ignore ]
Avatar
Rank
Joined  2010-06-15
Total Posts:  5
New Member

Hi Guys

I try to develop a DICOM Viewer with multitouch, but in this, what I do is convert the image into a format compatible with the libraries PYMT, in this, what I do is convert the image into a format compatible with PYMT libraries, and now I want to know is if I can display an image dicom (. dcm) in its original format, I have dealt with PIL but has not worked . I if anyone has any idea or has already been done before me would be helpful.

Profile
 
 
Posted: 02 December 2010 05:48 AM   [ Ignore ]   [ # 1 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

Never deal with dicom, but when searching on google i got : http://code.google.com/p/pydicom
Check http://code.google.com/p/pydicom/source/browse/source/dicom/examples/interactive_session_downsize_image.txt

The pixel array is available with “ds.pixel_array”, and size with “ds.shape”

Dunno exactly which format is it, but you could use pygame to reconstruct the image : http://www.pygame.org/docs/ref/image.html#pygame.image.fromstring
It would like something :

from pymt.core.image import ImageData

# put the data in a container
imagedata ImageData(ds.shape[0]ds.shape[1]'RGB'ds.pixel_array)

# create a texture from the pygame image object
texture Texture.create(ds.shape[0]ds.shape[1])
texture.blit_data(imagedata)

# create the image object from the texture
image Image(texture)

# then, create a scatter image object using our image object
scatter MTScatterImage(image=image)

This code is not tested, i’m sure you need to explore more the dicom image format and handle all possitbilities, but then the rest should work smile

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 03 December 2010 08:34 AM   [ Ignore ]   [ # 2 ]
Avatar
Rank
Joined  2010-06-15
Total Posts:  5
New Member

Ok, Mathieu I’ll try that way, I had no time to test, and since I had tried what was in it: http://code.google.com/p/pydicom/wiki/ViewingImages
but not the results I expected, I will read carefully the pygame documentation and tell you the results.

thanks. smile

Profile
 
 
Posted: 03 December 2010 10:04 AM   [ Ignore ]   [ # 3 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

Very good, i didn’t see it !

im Image.frombuffer(modesizeds.PixelData"raw"mode01)

Replace my code with that line :D

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 12 January 2011 06:31 PM   [ Ignore ]   [ # 4 ]
Avatar
RankRankRank
Joined  2009-06-09
Total Posts:  268
Sr. Member

You can also integrate VTK into PyMT to load and render DICOM files.

@ Mathieu: My datasets were DICOM files. DICOM is a standard for medical datasets.

 Signature 

My Blog
PyMT—Create Multitouch Software easily!
Movid—New cross-platform tracker, work in progress!

Profile
 
 
Posted: 12 January 2011 10:35 PM   [ Ignore ]   [ # 5 ]
Avatar
Rank
Joined  2010-06-15
Total Posts:  5
New Member

Mmm, dennda I try this but does’nt work in windows rasberry, in ubuntu I try this with this patch http://txzone.net/files/contrib/vtk/ but not work for me, I dont know if it was because the version of vtk or was a problem with python? :(

Profile
 
 
Posted: 22 August 2013 11:03 PM   [ Ignore ]   [ # 6 ]
Rank
Joined  2013-08-22
Total Posts:  2
New Member

here is my little project in displaying dicom image c#, you can have a look. maybe it is what you are looking. very good at loading saving annotating and so on. east to read images in dicom formats.

Profile
 
 
Posted: 12 December 2013 10:17 PM   [ Ignore ]   [ # 7 ]
Rank
Joined  2013-12-02
Total Posts:  20
New Member

You may try to install a DICOM viewer add-on on your pc or mobile devices, such as local database, CD/DVD to display DICOM image on the web with AJAX-enable, besides, this kind of DICOM reader contains advanced image processing capabilities.

Profile