예제 #1
0
 def test_create_buy(self):
     register(self)
     event_title = "DESTROY ALL HUMANS"
     possible_winners = '10'
     cost = '10.00'
     event_desc = ("Join me in our weekly potluck to discuss the future of destroying humans."
                   "John will bring fresh oil, but brining your own will me much appreciated. Please contact Sara "
                   "about more controversial networking not concerning destorying humans. ")
     self.open(host + '/events/create/')
     self.update_text('#id_title', event_title)
     self.update_text('#id_description', event_desc)
     self.update_text('#id_datetime', datetime.date(2022, 11, 9).strftime('%Y-%m-%d %H:%M'))
     self.find_element("#id_event_type").send_keys(3)
     self.find_element("#id_event_type").send_keys(Keys.UP)
     self.find_element("#id_event_type").send_keys(Keys.DOWN)
     self.find_element("#id_event_type").send_keys(Keys.DOWN)
     self.update_text("#id_num_possible_winners", possible_winners)
     self.update_text("#id_cost", cost)
     time.sleep(10)
     self.click('.btn-primary-new')
     self.assertTrue(self.get_text("h1"), event_title)
     self.assertTrue(self.get_text("#num_curr_winners"), '0')
     self.assertTrue(self.get_text("#num_possible_winners"), possible_winners)
     # self.assertTrue(self.get_text("#cost", cost))
     time.sleep(2)
     self.click("#delete")
     time.sleep(1)
     self.click(".btn-danger")
예제 #2
0
def confirm_user(name, username, phone, email, password, security_pin,
                 security_question):
    attempt_question = input("\nProvide Answer to the Security Question: ")
    if attempt_question == security_pin:
        print("Your Current Password is: " + password)
        login.login_area(name, username, phone, email, password, security_pin,
                         security_question)
    else:
        print("I do not understand you...")
        registration.register()
예제 #3
0
    def test_profile_bio(self):
        register(self)
        self.open(host + '/profiles/' + self.username + '/edit/')
        profile_desc = (
            "Join me in our weekly potluck to discuss the future of destroying humans."
            "John will bring fresh oil, but brining your own will me much appreciated. Please contact Sara "
            "about more controversial networking not concerning destorying humans or cookies. "
        )

        self.update_text('#id_bio', profile_desc)
        time.sleep(1)
        self.click('.btn-primary-new')
        self.assertTrue(self.get_text("h2"), self.username)
        self.assertTrue(self.get_text("#bio"), profile_desc)
예제 #4
0
def main():
    image1 = './T1w.nii.gz'
    image2 = './T1w_acpc.nii.gz'

    image1 = nb.load(image1)
    image2 = nb.load(image2)

    im1hd = image1.affine
    im2hd = image2.affine

    imdata1 = image1.get_fdata()
    imdata2 = image2.get_fdata()

    imdata1 = tf.constant(imdata1)
    imdata2 = tf.constant(imdata2)
    im1hd = tf.constant(im1hd)
    im2hd = tf.constant(im2hd)

    graph = registration.register(imdata1, imdata2, im1hd, im2hd)

    init_op = tf.initialize_all_variables()

    with tf.Session() as sess:
        sess.run(init_op)
        graph = sess.run(graph)

    x = 1
예제 #5
0
def front_door():
    print("\nWelcome to Walk-In Tech Python Tutorial Course\n")
    print("Press R to register")
    print("Press L to login")
    ask = input(": ")
    if ask.lower() == "r":
        r.register()
    elif ask.lower() == "l":
        try:
            login.login_area()
        except TypeError:
            print("Service/Function Coming soon...")
            front_door()
    else:
        print("Something went wrong")
        front_door()
예제 #6
0
def register_user():
    if str(request.args.get('email')) == "None":
        new_email = ""
    else:
        new_email = str(request.args.get('email'))
    if str(request.args.get('password')) == "None":
        new_password = ""
    else:
        new_password = str(request.args.get('password'))
    if str(request.args.get('userType')) == "None":
        new_user_type = ""
    else:
        new_user_type = str(request.args.get('userType'))
    if str(request.args.get('firstName')) == "None":
        first_name = ""
    else:
        first_name = str(request.args.get('firstName'))
    if str(request.args.get('secondName')) == "None":
        second_name = ""
    else:
        second_name = str(request.args.get('secondName'))
    if str(request.args.get('middleName')) == "None":
        middle_name = ""
    else:
        middle_name = str(request.args.get('middleName'))
    if str(request.args.get('organizationName')) == "None":
        organization_name = ""
    else:
        organization_name = str(request.args.get('organizationName'))
    return registration.register(new_email, new_password, new_user_type,
                                 first_name, second_name, middle_name,
                                 organization_name)
예제 #7
0
 def test_registration(self):
     course = registration.Course("Test course")
     self.assert_(registration.register(course, "*****@*****.**"),
                  'Registration should be successfull')
     self.assert_("*****@*****.**" in course.members.keys(),
                  'email is added to members')
     self.assertEqual(course.members["*****@*****.**"], "unconfirmed",
                      'but it should be unconfirmed')
예제 #8
0
def menu():
    print(
        "*******************************MAIN MENU*********************************"
    )
    print("Please, choose option: ")
    print(
        "-------------------------------------------------------------------------"
    )
    print("1. Log into the system")
    print("2. Registration")
    print("3. Leave the aplication")
    print(
        "-------------------------------------------------------------------------"
    )

    try:  #with try and except we are avoiding breaking of program if wrong value is entered
        print("")
        option = int(input("Choose your option: "))
        if option == 1:
            log()
            menu()

        elif option == 2:
            register()
            menu()

        elif option == 3:
            print(
                "-------------------------------------------------------------"
            )
            print("You left the aplication.")
            exit()  #exiting program

        else:
            print(
                "-------------------------------------------------------------"
            )
            print("Wrong enter! Please, try again.")
            menu()

    except ValueError:  #with this exeption we are preventing program from breaking if string is entered
        print("-------------------------------------------------------------")
        print("Wrong enter. Please, try again.")
        menu()
예제 #9
0
def registration_process():
    """Pls register yourself, to enter any class.
    ---
    parameters:
        - name: name
          in: query
          type: string
          required: true
        - name: phone
          in: query
          type: number
          required: true
    responses:
        200:
            description: The output values
        
    """
    name = request.args.get('name')
    phone = request.args.get('phone')
    registration.register(name)
    return name + ", you have successfully registered."
예제 #10
0
파일: blocked.py 프로젝트: kahihia/Apogee1
 def test_create_buy(self):
     # Create as a Creator
     register(self)
     event_title = "DESTROY ALL HUMANS"
     possible_winners = '10'
     cost = '10.00'
     event_desc = (
         "Join me in our weekly potluck to discuss the future of destroying humans."
         "John will bring fresh oil, but brining your own will me much appreciated. Please contact Sara "
         "about more controversial networking not concerning destorying humans. "
     )
     self.open(host + '/events/create/')
     self.update_text('#id_title', event_title)
     self.update_text('#id_description', event_desc)
     self.update_text('#id_datetime',
                      datetime.date(2022, 11, 9).strftime('%Y-%m-%d %H:%M'))
     self.find_element("#id_event_type").send_keys(3)
     self.find_element("#id_event_type").send_keys(Keys.UP)
     self.find_element("#id_event_type").send_keys(Keys.DOWN)
     self.find_element("#id_event_type").send_keys(Keys.DOWN)
     self.update_text("#id_num_possible_winners", possible_winners)
     self.update_text("#id_cost", cost)
     time.sleep(10)
     self.click('.btn-primary-new')
     self.assertTrue(self.get_text("h1"), event_title)
     self.assertTrue(self.get_text("#num_curr_winners"), '0')
     self.assertTrue(self.get_text("#num_possible_winners"),
                     possible_winners)
     cur_event_link = self.get_current_url()
     # Block test fan
     self.open(host + '/profiles/' + self.fan_username)
     self.click("#blockButton")
     self.click("#modalBlockButton")
     time.sleep(3)
     self.open(host + '/accounts/logout/')
     # Join as a User
     fan_login(self)
     self.open(cur_event_link)
     self.assertTrue(self.get_text("h1"), "Forbidden Page - 403")
     time.sleep(10)
def shift_frame(input):
    '''
    Takes in transformation matrix; does homography transformation to register/align two frames
    '''
    frame = input[0]
    previous_frame = input[1]

    M = register(previous_frame, frame)

    return (cv2.warpPerspective(
        previous_frame, M,
        (previous_frame.shape[1], previous_frame.shape[0])).astype(np.uint8),
            M)
예제 #12
0
def registerImage():
    ax = out_fig.axes[0]
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)

    global output_image
    output_image = register(master_image,
                            slave_image,
                            registration_type=warp_type.get())

    t = np.arange(0, 3, .01)

    if gray_scale_val.get():
        ax.imshow(rgb2gray(output_image), cmap='gray')
        output_image = rgb2gray(output_image)
    else:
        ax.imshow(output_image)

    if grid_val.get():
        ax.get_xaxis().set_visible(True)
        ax.get_yaxis().set_visible(True)
        ax.grid(color='r', linewidth=2)

    out_canvas.draw()
예제 #13
0
    def process_images(self):
        '''
        Registration, background correction and cutting of images
        '''


        '''
        Registration
        '''
        ref_image = tiff.imread(glob.glob(self._path + '/w_raw/phase/*_Propidium iodide_200_XF116*.tif'))
        for i in range(0, (len(self._melc_fluor)-1)):

            pb_idx = np.where(self._melc_phasebleach['order_index'] == self._melc_bleach.iloc[i]['order_index'])[0][0]
            phasebleach_image = tiff.imread(self._melc_phasebleach.iloc[pb_idx]['path'])
            bleach_image = tiff.imread(self._melc_bleach.iloc[i]['path'])
            registered_bleach_image = register(ref_image, phasebleach_image, bleach_image)
            filename_bleach = '/' + str(int(self._melc_bleach.iloc[i]['order_index'])) + '_' + '_'.join(
                self._melc_bleach.iloc[i]['fid'].split('_')[:-1]) + '.tif'
            tiff.imsave(self._path_registered_bleach + filename_bleach, registered_bleach_image)

            save_vis_img(registered_bleach_image, self._path_registered_vis_bleach, filename_bleach)

            p_idx = np.where(self._melc_phase['order_index'] == self._melc_fluor.iloc[i+1]['order_index'])[0][0]
            phase_image = tiff.imread(self._melc_phase.iloc[p_idx]['path'])
            fluorescence_image = tiff.imread(self._melc_fluor.iloc[i+1]['path'])
            registered_phase_image = register(ref_image, phase_image, phase_image)
            registered_fluor_image = register(ref_image, phase_image, fluorescence_image)
            filename_fluor = '/' + str(int(self._melc_fluor.iloc[i+1]['order_index'])) + '_' + '_'.join(
                self._melc_fluor.iloc[i+1]['fid'].split('_')[:-1]) + '.tif'
            tiff.imsave(self._path_registered_fluor + filename_fluor, registered_fluor_image)
            tiff.imsave(self._path_registered_phase + filename_fluor, registered_fluor_image)

            save_vis_img(registered_fluor_image, self._path_registered_vis_fluor, filename_fluor)
            save_vis_img(registered_phase_image, self._path_registered_vis_phase, filename_fluor)

            '''
            Prospective illumination correction
            '''
            bleach = np.int16(registered_bleach_image)
            fluor = np.int16(registered_fluor_image)
            phase = np.int16(registered_phase_image)

            if self._melc_fluor.iloc[i+1]['filter'] == 'XF111-2':
                fluor -= self._corrected_bf_im[1]
                phase -= self._corrected_bf_im[1]
            else:
                fluor -= self._corrected_bf_im[0]
                phase -= self._corrected_bf_im[0]

            if self._melc_bleach.iloc[i]['filter'] == 'XF111-2':
                bleach -= self._corrected_bf_im[1]
            else:
                bleach -= self._corrected_bf_im[0]

            phase[phase < 0] = 0

            '''
            Subtraction of preceding bleached image
            '''
            fluor_wo_bg = fluor - bleach
            fluor_wo_bg[fluor_wo_bg < 0] = 0

            tiff.imsave(self._path_bg_corr_f + filename_fluor, fluor_wo_bg)
            save_vis_img(fluor_wo_bg, self._path_bg_corr_v_f, filename_fluor)

            tiff.imsave(self._path_bg_corr_p + filename_fluor, phase)
            save_vis_img(phase, self._path_bg_corr_v_p, filename_fluor)

            '''
            Cut off outliers/hot pixels
            '''

            fluor_wo_bg_cut = hot_pixel_removal(fluor_wo_bg)
            phase_bc_cut = hot_pixel_removal(phase)
            tiff.imsave(self._path_cut_f + filename_fluor, fluor_wo_bg_cut)
            save_vis_img(fluor_wo_bg_cut, self._path_cut_v_f, filename_fluor)
            tiff.imsave(self._path_cut_p + filename_fluor, phase_bc_cut)
            save_vis_img(phase_bc_cut, self._path_cut_v_p, filename_fluor)
예제 #14
0
    cdf_m = (cdf_m - cdf_m.min())*255/(cdf_m.max()-cdf_m.min())
    cdf = numpy.ma.filled(cdf_m,0).astype('uint8')

    return cdf[grayscale]

# register signal handler
signal.signal(signal.SIGINT, sigint_handler)

# start pan-tilt subprocess and wait for completion
pan_tilt_stdout, pan_tilt_stderr = subprocess.Popen(["/home/alarm/pan-tilt"], stdout=subprocess.PIPE).communicate()
print "operation requested = " + pan_tilt_stdout

get_images()

# convert nir image to grayscale
cv2.imwrite(nir_normalized_image_file, normalize(nir_image_file))

# registration
nir_registered = registration.register(nir_normalized_image_file, rgb_image_file)
# nir_registered = registration.register('01_nir.tiff', '01_rgb.tiff')
cv2.imwrite(nir_registered_image_file, nir_registered)


if pan_tilt_stdout == op_skin_smoothing:
    final_image = merging.merge(rgb_image_file, nir_image_file)
    cv2.imwrite(skin_smoothing_image_file, final_image)

elif pan_tilt_stdout == op_shadow_detection:
    final_image = shadow_detection.shadowDetection(rgb_image_file, nir_image_file)
    cv2.imwrite(shadow_detection_image_file, final_image)
예제 #15
0
#serversocket.listen(5)

print('server started and listening')
video_file_name = "input_videos/input.mp4"

while 1:
    try:
        (clientsocket, address) = soc.accept()
        print("connection found!")
        name = clientsocket.recv(1024).decode()
        print(name)
        reply = 'OK'
        clientsocket.send(reply.encode())
        ##        if(savefilename[-4:]!=".mp4"):
        ##            savefilename+=".mp4"
        ##
        ##        savefilename = "input_videos/"+savefilename
        #savefilename = input("enter file name to receive: ")
        with clientsocket, open(video_file_name, 'wb') as file:
            while True:
                recvfile = clientsocket.recv(4096)
                if not recvfile: break
                file.write(recvfile)
        print("File has been received.")
        registration.register(video_file_name, name)

    except KeyboardInterrupt:
        print('interrupted!')
        break
예제 #16
0
        for country_tup in country_tups:
            code = country_tup[0]
            if prev_code != code:
                prev_code = code
                i = 1
            code_id = "%02d" % i
            if code in area:
                code_id = Country.objects.filter(code=code).first().pk
                context_object = {}
                context_object['pk'] = dot
                dot += 1
                context_object['model'] = 'location.countrysubdivision'
                context_object['fields'] = {}
                context_object['fields']['country'] = code_id
                context_object['fields']['name'] = country_tup[2]
                context_object['fields']['cn_name'] = country_tup[5]
                context_object['fields']['code'] = '{}-{}'.format(
                    code, code_id)
                i += 1

                objects.append(context_object)

        return {'status_code': 200, 'data': objects}


register('sql', 'city', CityResource)
register('sql', 'state', StateResource)
register('sql', 'country', CountryResource)
register('sql', 'location', LocationResource)
register('sql', 'hk', HKResource)
예제 #17
0
파일: main.py 프로젝트: MashaNes/IoTS2021

@app.route("/start-heating", methods=['PUT'])
@cross_origin()
def start_heating():
    temperature = float(flask.request.args['temp'])
    actuation.turn_on_heating(temperature)
    return actuation.get_parameters()


@app.route("/start-diagnostics", methods=['PUT'])
@cross_origin()
def start_diagnostics():
    location = flask.request.args['loc']
    event = flask.request.args['event']
    actuation.run_diagnostics(location, event)
    return actuation.get_parameters()


@app.route("/adjust-tire-pressure", methods=['PUT'])
@cross_origin()
def adjust_tire_pressure():
    psi = float(flask.request.args['psi'])
    actuation.adjust_tire_pressure(psi)
    return actuation.get_parameters()


time.sleep(100)
registration.register(data_acquisition.get_station_name())
app.run()
 def test_registration(self):
     course=registration.Course("Test course")
     self.assert_(registration.register(course,"*****@*****.**"), 'Registration should be successfull')
     self.assert_("*****@*****.**" in course.members.keys(), 'email is added to members')
     self.assertEqual(course.members["*****@*****.**"], "unconfirmed", 'but it should be unconfirmed')
예제 #19
0
def log_out():
    # getting error about circular import
    # welcome.front_door()
    # so leading to  register
    r.register()
예제 #20
0
def newUser():
    email = request.form['email']
    registration.register(email)
    return render_template('login.html', goodPrompt=1)