def setUp(self): self.wb_mle = decode_mle.DecodeEnteteMle('./data/wb.dat') self.wb_mle.decode_entete() self.muga_mle = decode_mle.DecodeEnteteMle('./data/muga.dat') self.muga_mle.decode_entete() self.wb_xml = utils_xml.decode_xml(self.wb_mle.get_xml()[0]) self.muga_xml = utils_xml.decode_xml(self.muga_mle.get_xml()[0])
def main(): parser = create_parser() args = parser.parse_args() mle = DecodeEnteteMle(args.input) mle.decode_entete() xml = mle.get_xml()[0] dec_xml = utils_xml.decode_xml(xml) # pickle.dump(dec_xml, open(args.input.replace(".dat","")+'_xml.p','wb')) if args.subparser_name == 'XML': print "offset: ", mle.get_debut_codage_mle() + mle.get_taille_xml() print 10 * '==========' print "patient name: ", dec_xml.get_patientName() print "patient position: ", dec_xml.get_patient_position() print "date: ", dec_xml.get_acq_date() print "heure: ", dec_xml.get_acq_time() print "type d'image: ", dec_xml.get_image_type() if dec_xml.get_image_type() == 'wb': print "-----> step&Shoot: ", dec_xml.get_gantry_isStepShoot() if dec_xml.get_gantry_stepVelocity(): print "-----> stepVelocity: ", dec_xml.get_gantry_stepVelocity() print "nb pixels x: ", dec_xml.get_dimension_x() print "nb pixels y: ", dec_xml.get_dimension_y() print "energy range: ", dec_xml.get_energy_range() print "mirror: ", dec_xml.get_mirror() print "decal X: ", dec_xml.get_decal_x() print "decal Y: ", dec_xml.get_decal_y() print "zoom: ", dec_xml.get_zoom() print "center E: ", dec_xml.get_E_centerLine() print "low E: ", dec_xml.get_E_low() print "high E: ", dec_xml.get_E_high() print 10 * '==========' elif args.subparser_name == 'BIN': bin_mle = DecodeBinaireMle(args.input, mle.get_offset()) # pickle.dump(bin_mle.parcours_fichier(), open(args.input.replace(".dat", ".p"),'wb')) obj = encode_images.EncodeStatic(bin_mle.parcours_fichier(), dec_xml) image = utils_images.CreateImages(obj.create_image()) image.write_image('static.mhd')