Compare View
Commits (2)
-
To enable starting InVesalius by importing app.py and calling main().
Showing
3 changed files
Show diff stats
app.py
... | ... | @@ -490,9 +490,41 @@ def print_events(topic=Publisher.AUTO_TOPIC, **msg_data): |
490 | 490 | utils.debug("%s\n\tParameters: %s" % (topic, msg_data)) |
491 | 491 | |
492 | 492 | |
493 | +def init(): | |
494 | + """ | |
495 | + Initialize InVesalius. | |
496 | + | |
497 | + Mostly file-system related initializations. | |
498 | + """ | |
499 | + #Is needed because of pyinstaller | |
500 | + multiprocessing.freeze_support() | |
501 | + | |
502 | + #Needed in win 32 exe | |
503 | + if hasattr(sys,"frozen") and sys.platform.startswith('win'): | |
504 | + | |
505 | + #Click in the .inv3 file support | |
506 | + root = winreg.HKEY_CLASSES_ROOT | |
507 | + key = "InVesalius 3.1\InstallationDir" | |
508 | + hKey = winreg.OpenKey (root, key, 0, winreg.KEY_READ) | |
509 | + value, type_ = winreg.QueryValueEx (hKey, "") | |
510 | + path = os.path.join(value,'dist') | |
511 | + | |
512 | + os.chdir(path) | |
513 | + | |
514 | + if not inv_paths.USER_INV_DIR.exists(): | |
515 | + inv_paths.create_conf_folders() | |
516 | + if inv_paths.OLD_USER_INV_DIR.exists(): | |
517 | + inv_paths.copy_old_files() | |
518 | + | |
519 | + if hasattr(sys,"frozen") and sys.frozen == "windows_exe": | |
520 | + # Set system standard error output to file | |
521 | + path = inv_paths.USER_LOG_DIR.join("stderr.log") | |
522 | + sys.stderr = open(path, "w") | |
523 | + | |
524 | + | |
493 | 525 | def main(connection=None): |
494 | 526 | """ |
495 | - Initialize InVesalius GUI | |
527 | + Start InVesalius. | |
496 | 528 | |
497 | 529 | Parameters: |
498 | 530 | connection: An object to communicate with the outside world. |
... | ... | @@ -505,6 +537,8 @@ def main(connection=None): |
505 | 537 | functionality, InVesalius needs to be started by calling the main |
506 | 538 | function directly with a proper connection object. |
507 | 539 | """ |
540 | + init() | |
541 | + | |
508 | 542 | options, args = parse_command_line() |
509 | 543 | |
510 | 544 | session = ses.Session() |
... | ... | @@ -536,30 +570,4 @@ def main(connection=None): |
536 | 570 | |
537 | 571 | |
538 | 572 | if __name__ == '__main__': |
539 | - #Is needed because of pyinstaller | |
540 | - multiprocessing.freeze_support() | |
541 | - | |
542 | - #Needed in win 32 exe | |
543 | - if hasattr(sys,"frozen") and sys.platform.startswith('win'): | |
544 | - | |
545 | - #Click in the .inv3 file support | |
546 | - root = winreg.HKEY_CLASSES_ROOT | |
547 | - key = "InVesalius 3.1\InstallationDir" | |
548 | - hKey = winreg.OpenKey (root, key, 0, winreg.KEY_READ) | |
549 | - value, type_ = winreg.QueryValueEx (hKey, "") | |
550 | - path = os.path.join(value,'dist') | |
551 | - | |
552 | - os.chdir(path) | |
553 | - | |
554 | - if not inv_paths.USER_INV_DIR.exists(): | |
555 | - inv_paths.create_conf_folders() | |
556 | - if inv_paths.OLD_USER_INV_DIR.exists(): | |
557 | - inv_paths.copy_old_files() | |
558 | - | |
559 | - if hasattr(sys,"frozen") and sys.frozen == "windows_exe": | |
560 | - # Set system standard error output to file | |
561 | - path = inv_paths.USER_LOG_DIR.join("stderr.log") | |
562 | - sys.stderr = open(path, "w") | |
563 | - | |
564 | - # Init application | |
565 | 573 | main() | ... | ... |
invesalius/constants.py
invesalius/gui/dialogs.py
... | ... | @@ -1181,7 +1181,7 @@ def ShowAboutDialog(parent): |
1181 | 1181 | info = AboutDialogInfo() |
1182 | 1182 | info.Name = "InVesalius" |
1183 | 1183 | info.Version = const.INVESALIUS_VERSION |
1184 | - info.Copyright = _("(c) 2007-2019 Center for Information Technology Renato Archer - CTI") | |
1184 | + info.Copyright = _("(c) 2007-2022 Center for Information Technology Renato Archer - CTI") | |
1185 | 1185 | info.Description = wordwrap(_("InVesalius is a medical imaging program for 3D reconstruction. It uses a sequence of 2D DICOM image files acquired with CT or MRI scanners. InVesalius allows exporting 3D volumes or surfaces as mesh files for creating physical models of a patient's anatomy using additive manufacturing (3D printing) technologies. The software is developed by Center for Information Technology Renato Archer (CTI), National Council for Scientific and Technological Development (CNPq) and the Brazilian Ministry of Health.\n\n InVesalius must be used only for research. The Center for Information Technology Renato Archer is not responsible for damages caused by the use of this software.\n\n Contact: invesalius@cti.gov.br"), 350, wx.ClientDC(parent)) |
1186 | 1186 | |
1187 | 1187 | # _("InVesalius is a software for medical imaging 3D reconstruction. ")+\ | ... | ... |