Пример #1
0
def processfile_3(fn, opt):
    dfo = dicom.open_dicomfile(fn, dicom.OPT_LOAD_CONTINUE_ON_ERROR)
    
    if opt['opt_ignore']:
        if dfo and not dicom.get_error_message():
            print dfo.dump_string(fn+' : ').rstrip()
    else:
        if dfo:
            if not opt['opt_quite']:
                print dfo.dump_string(fn+' : ').rstrip()
                
            errmsg = dicom.get_error_message()
            if errmsg:
                print fn+' : ** ERROR IN LOADING A DICOM FILE; '+errmsg
                
        else:
            print fn+' : ** NOT A DICOM FILE'
            
    if dfo and opt['opt_extract']:
        extract_image(fn, dfo)
Пример #2
0
    else:
        print "  Patient name is not available"


# get binary dat
def example_06_get_binary_data(df):
    print "Example 06 Get Binary Data"

    pixeldata = df.get_dataelement(0x7FE00010).raw_value()
    if pixeldata:
        print "    Length of pixel data is {0} bytes.".format(len(pixeldata))
    else:
        print "    Pixel data is not available.\n"


if __name__ == "__main__":
    df = dicom.open_dicomfile("img001.dcm")
    if not df:
        print dicom.get_error_message()
        sys.exit(-1)

    example_01_longform(df)
    example_01_shortform(df)
    example_02_get_int(df)
    example_03_get_double(df)
    example_04_get_double_values(df)
    example_05_get_string(df)
    example_06_get_binary_data(df)

    del df  # if you need to destroy dicomfile object explicitly
Пример #3
0
	if patient_name:
		print "  Patient name = {0}".format(patient_name)
	else:
		print "  Patient name is not available"
	
# get binary dat 
def example_06_get_binary_data(df):
	print "Example 06 Get Binary Data"

	pixeldata = df.get_dataelement(0x7fe00010).raw_value()
	if pixeldata:
		print "    Length of pixel data is {0} bytes.".format(len(pixeldata))
	else:
		print "    Pixel data is not available.\n"

if __name__=="__main__":
	df = dicom.open_dicomfile("img001.dcm")
	if not df:
		print dicom.get_error_message()
		sys.exit(-1)		

	example_01_longform(df)
	example_01_shortform(df)
	example_02_get_int(df)
	example_03_get_double(df)
	example_04_get_double_values(df)
	example_05_get_string(df)
	example_06_get_binary_data(df)

	del df # if you need to destroy dicomfile object explicitly