hi,

I have a images in bmp format and I would like to convert into dicom. I am not a professional in python or vtk. if you may have advice, please reply me.

I have started like this but it does not work :(...

file_in = 'C:/programfile/image.bmp'
file_out = 'test1.dcm'
vtkGDCMImageReader()

In last, i am only interested to read all pixel or voxel values of the bmp image(python) if any one have idea how to do this, just reply.

Thankyou

Julia

Use PIL for reading bmp images:

import Image
img = Image.open( "bmpfile.bmp" )
pixels = list()
for row in img.size()[ 0 ] :
    for col in img.size()[ 1 ] :
        pixels.append( img.getpixel( row, col ) )

As for saving the file as dicom try the pydicom module

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.