- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/AngioLocalizeNoAuto/MevisLabNoAutoReg/STUMevisApp/Angiolocalize/Modules/Macros/STUAngioLocalize/AngioLocalize.py

    00001 """
    00002 * Copyright (c) 2009 Stanford University, School of Medicine All rights reserved.
    00003 *
    00004 * STANFORD ACADEMIC SOFTWARE LICENSE AGREEMENT
    00005 * FOR AngioLocalize SOURCE CODE:
    00006 *
    00007 * 1.  This is a legal agreement between you, RECIPIENT, and STANFORD UNIVERSITY.
    00008 *       By accepting, receiving, and using AngioLocalize.including any accompanying information, materials or
    00009 *       manuals (Program), you are agreeing to be bound by the terms of this Agreement.
    00010 *       If you do not agree to the terms of this Agreement, promptly return the Program to the STANFORD.
    00011
    00012 * 2.  STANFORD grants to RECIPIENT a royalty-free, nonexclusive, and nontransferable license to use the Program
    00013 *       and accompanying source code furnished hereunder, upon the terms and conditions set out below.
    00014 *       documentation and/or other materials provided with the distribution.
    00015 * 3.  RECIPIENT acknowledges that the Program is a research tool still in the development stage and that
    00016 *       it is being supplied as is, without any accompanying services, support or improvements from STANFORD.
    00017 * 4.  RECIPIENT agrees to use the Program solely for internal non-commercial purposes.
    00018 * 5.  RECIPIENT may create derivatives and further transfer the Program under the following terms and conditions:
    00019 *        A) Recipient agrees to not commercially exploit the Program and agrees all uses will be for non-commercial purposes; and,
    00020 *        B) Recipient may not mark any derivatives with the title of Program and may not to use iPad mark for any derivatives; and,
    00021 *        C) Recipient agrees to mark and acknowledge all derivatives as follows: "This is a derivative work based on AngioLocalize:
    00022 *           Frameless AVM localization with 2D Digital Subtraction Angiography (DSA) and 3D Rotational Angiography (DRA) Images developed
    00023 *           by Dimitre Hristov, Lina Liu.
    00024 *        D) Recipient agrees to make all improvements, enhancements and derivatives available under
    00025 *           similar terms and conditions to the research community.
    00026 * 6.   RECIPIENT warrants that RECIPIENT will not remove or export any part of the software or Program from the United
    00027 *       States except in full compliance with all United States and other applicable laws and regulations.
    00028 * 7.  RECIPIENT will use the Program in compliance with all applicable laws, policies and regulations including, but not
    00029 *       limited to, any approvals, informed consent and patient confidentiality principles.
    00030 * 8.   RECIPIENT will indemnify, hold harmless, and defend Stanford against any claim of any kind arising out of or
    00031 *       related to the exercise of any rights granted under this Agreement or the breach of this Agreement by RECIPIENT.
    00032 * 9.  Title and copyright to the Program and any associated documentation shall at all times remain with STANFORD,
    00033 *       and RECIPIENT agrees to preserve same.
    00034 """
    00035 #----------------------------------------------------------------------------------
    00036 #! Macro module AngioLocalize
    00037 #/*!
    00038 # \file    AngioLocalize.py
    00039 # \author  LinaLiu
    00040 # \date    2009-12-10
    00041 #
    00042 #
    00043 #*/
    00044 #----------------------------------------------------------------------------------
    00045
    00046 from mevis import *
    00047 from PythonQt import *
    00048 import time;
    00049 import os;
    00050 currentPatient = None
    00051 title = ""
    00052
    00053 ## initWindow():
    00054 def initWindow():
    00055   ctx.field("unverified").setBoolValue(True);
    00056   ctx.field("isAdmin").setBoolValue(False);
    00057
    00058 ## copy log file when application is closed
    00059 def closeWindow():
    00060   logFile = MLAB.variable("Logfile");
    00061   if not os.path.exists(logFile):
    00062     MLAB.showWarning("Please set the logfile path from Edit->Preferences->Developer in order to have AngioLocalize special logs.");
    00063   else:
    00064     MLABFileManager.copy(logFile, logFile +  "--AngioLocalize(" + time.strftime("%Y%m%d-%H%M%S") + ")");
    00065
    00066 #----------------------------------------------------------------------------------
    00067 # The command below does not execute properly on Mevis 2.1
    00068 #  MLAB.runCommand("ren", "c:/temp/mevisLab.log  c:/temp/mevisLab.log." +  time.strftime("%Y%m%d-%H%M%S") );
    00069 #----------------------------------------------------------------------------------
    00070 ## this is the function called when user is verfied in login page
    00071 def loggedIn():
    00072   if (ctx.field("angioLogin.isAdmin").value == True):
    00073     ctx.field("isAdmin").setBoolValue(True);
    00074   ctx.field("unverified").setBoolValue(False);
    00075   ctx.controlDebug("PatientSelection").setEnabled(True);
    00076
    00077
    00078 ## this function is used to init DSA2D tab
    00079 def DSA2DInit():
    00080    ## All patient related information is passed to the DSA2D module
    00081    ctx.field("DSA2D.PatientID").setValue(ctx.field("PatientID").value);
    00082    ctx.field("DSA2D.PatientsName").setValue(ctx.field("PatientsName").value);
    00083    ctx.field("DSA2D.PatientsBirthDate").setValue(ctx.field("PatientsBirthDate").value);
    00084    ctx.field("DSA2D.PatientsSex").setValue(ctx.field("PatientsSex").value);
    00085
    00086 ## this function is used to init DSA3D tab
    00087 def DSA3DInit():
    00088    ## all the patient related information is passed to the DSA3D module
    00089    ctx.field("DSA3D.PatientID").setValue(ctx.field("PatientID").value);
    00090    ctx.field("DSA3D.PatientsName").setValue(ctx.field("PatientsName").value);
    00091    ctx.field("DSA3D.PatientsBirthDate").setValue(ctx.field("PatientsBirthDate").value);
    00092    ctx.field("DSA3D.PatientsSex").setValue(ctx.field("PatientsSex").value);
    00093
    00094 ## this function is used to init Registration tab
    00095 def RegistrationInit():
    00096    ## all the patient related information is passed to Registration module
    00097    check();
    00098    ctx.field("Registration.PatientID").setValue(ctx.field("PatientID").value);
    00099    ctx.field("Registration.PatientsName").setValue(ctx.field("PatientsName").value);
    00100    ctx.field("Registration.PatientsBirthDate").setValue(ctx.field("PatientsBirthDate").value);
    00101    ctx.field("Registration.PatientsSex").setValue(ctx.field("PatientsSex").value);
    00102    ctx.module("Registration").call("initWindow");
    00103    ctx.module("Registration2D3D").call("initWindow");
    00104
    00105 ## this function is used to init Registration2D3D tab
    00106 def Registration2D3DInit():
    00107    ## all the patient related information is passed to Registration2D3D module
    00108    check();
    00109    ctx.field("Registration2D3D.PatientID").setValue(ctx.field("PatientID").value);
    00110    ctx.field("Registration2D3D.PatientsName").setValue(ctx.field("PatientsName").value);
    00111    ctx.field("Registration2D3D.PatientsBirthDate").setValue(ctx.field("PatientsBirthDate").value);
    00112    ctx.field("Registration2D3D.PatientsSex").setValue(ctx.field("PatientsSex").value);
    00113    ctx.module("Registration2D3D").call("initWindow");
    00114
    00115
    00116 ## this function is used to init Localization tab
    00117 def LocalizationInit():
    00118    ## all the patient related information is passed to Localization module
    00119    check();
    00120    ctx.field("LocalizationWrapper.PatientID").setValue(ctx.field("PatientID").value);
    00121    ctx.field("LocalizationWrapper.PatientsName").setValue(ctx.field("PatientsName").value);
    00122    ctx.field("LocalizationWrapper.PatientsBirthDate").setValue(ctx.field("PatientsBirthDate").value);
    00123    ctx.field("LocalizationWrapper.PatientsSex").setValue(ctx.field("PatientsSex").value);
    00124    ctx.module("LocalizationWrapper").call("initWindow");
    00125
    00126
    00127 ## this function is used to clean up Localization tab
    00128 def LocalizationDone():
    00129   locM = ctx.module("LocalizationWrapper");
    00130   locM.call("cancel");
    00131   dbM = locM.module("DBConn");
    00132   dbM.call("close");
    00133
    00134 ## this function is used to clean up DSA2D tab
    00135 def DSA2DDone():
    00136   dsa2dM = ctx.module("DSA2D");
    00137   dsa2dM.call("cleanUp");
    00138   dbM = dsa2dM.module("DBConn");
    00139   dbM.call("close");
    00140
    00141 ## this function is used to clean up DSA3D tab
    00142 def DSA3DDone():
    00143   dsa3dM = ctx.module("DSA3D");
    00144   dsa3dM.call("cleanUp");
    00145   dbM = dsa3dM.module("DBConn");
    00146   dbM.call("close");
    00147
    00148 ## this function is used to clean up DSA tab, which includes DSA2D and DSA3D
    00149 def DSATabDone():
    00150    DSA2DDone();
    00151    DSA3DDone();
    00152
    00153 ## this function is used to clean up registration tab.
    00154 def RegistrationDone():
    00155   dsa2dM = ctx.module("Registration");
    00156   dsa2dM.call("cleanUp");
    00157   dbM = dsa2dM.module("DBConn");
    00158   dbM.call("close");
    00159
    00160 ## this function is used to clean up Registration2D3D tab.
    00161 def Registration2D3DDone():
    00162   dsa2dM = ctx.module("Registration2D3D");
    00163   dsa2dM.call("cleanUp");
    00164   dbM = dsa2dM.module("DBConn");
    00165   dbM.call("close");
    00166
    00167 ## this function is used to clean up Registration Tab, which includes Registration 3D-3D and Registration 2D-3D subTabs
    00168 def RegistrationTabDone():
    00169   RegistrationDone();
    00170   Registration2D3DDone();
    00171
    00172 ## this function is used to check if there is a patient selected.
    00173 def check():
    00174   title = ctx.window().title();
    00175   if (title == "Angio-Localize angioLocalize"):
    00176     MLAB.showInformation("Please select a patient in Patient Selection Tab first.");
    00177     return;
    00178   DSA2DInit();
    00179
    00180 ## When a user selects a patient, the tabs "Image Selection", "Registration" and "Localization" will be shown
    00181 def selectPatient():
    00182   selected = ctx.field("PatientsRecords.itemSelected").value;
    00183   ctx.field("patientSelected").setValue(selected);
    00184
    00185 ## this function is used to init Localization tab
    00186 def ExportInit():
    00187    ## all the patient related information is passed to Localization module
    00188    check();
    00189    ctx.field("AngioExport.PatientID").setValue(ctx.field("PatientID").value);
    00190    ctx.field("AngioExport.PatientsName").setValue(ctx.field("PatientsName").value);
    00191    ctx.field("AngioExport.PatientsBirthDate").setValue(ctx.field("PatientsBirthDate").value);
    00192    ctx.field("AngioExport.PatientsSex").setValue(ctx.field("PatientsSex").value);
    00193    ctx.module("AngioExport").call("initWindow");
    00194
    00195
    00196 ## this function is used to clean up Localization tab
    00197 def ExportDone():
    00198   locM = ctx.module("AngioExport");
    00199   locM.call("cleanUp");
    00200   dbM = locM.module("DBConn");
    00201   dbM.call("close");
    00202
    00203
    00204 #//# MeVis signature v1
    00205 #//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBANEfsmYse2e1dRhkQ9AQbreCq9uxwzWLoGom13MNYmyfwoJqQOEXljLFAgw2eEjaT12G4CdqKWhRxh9ANP6n7GMCARE=:VI/mB8bT4u+mRtf/ru8yUQi8BzpaS3UeL2x62YxsUYnVqCWuLrVNLiukIIjnJMKQXlc8ezmgOIcVAV7pgvgKpQ==
    00206 #//# owner: MeVis
    00207 #//# date: 2009-06-10T04:12:25
    00208 #//# hash: vHSfj+Qt8xrIkDVP4W0Rep0YH6a3+MySa0+Cs+AoqEK/IbB+f5szwmyVTENOjzz/JEgm2t31FtHmUUMFcQg5VQ==
    00209 #//# MeVis end
    00210

All Classes Namespaces Files Functions Variables Enumerator Friends