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,9 +490,41 @@ def print_events(topic=Publisher.AUTO_TOPIC, **msg_data): | ||
490 | utils.debug("%s\n\tParameters: %s" % (topic, msg_data)) | 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 | def main(connection=None): | 525 | def main(connection=None): |
494 | """ | 526 | """ |
495 | - Initialize InVesalius GUI | 527 | + Start InVesalius. |
496 | 528 | ||
497 | Parameters: | 529 | Parameters: |
498 | connection: An object to communicate with the outside world. | 530 | connection: An object to communicate with the outside world. |
@@ -505,6 +537,8 @@ def main(connection=None): | @@ -505,6 +537,8 @@ def main(connection=None): | ||
505 | functionality, InVesalius needs to be started by calling the main | 537 | functionality, InVesalius needs to be started by calling the main |
506 | function directly with a proper connection object. | 538 | function directly with a proper connection object. |
507 | """ | 539 | """ |
540 | + init() | ||
541 | + | ||
508 | options, args = parse_command_line() | 542 | options, args = parse_command_line() |
509 | 543 | ||
510 | session = ses.Session() | 544 | session = ses.Session() |
@@ -536,30 +570,4 @@ def main(connection=None): | @@ -536,30 +570,4 @@ def main(connection=None): | ||
536 | 570 | ||
537 | 571 | ||
538 | if __name__ == '__main__': | 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 | main() | 573 | main() |
invesalius/constants.py
@@ -28,7 +28,7 @@ from invesalius import utils | @@ -28,7 +28,7 @@ from invesalius import utils | ||
28 | from invesalius import inv_paths | 28 | from invesalius import inv_paths |
29 | 29 | ||
30 | #from invesalius.project import Project | 30 | #from invesalius.project import Project |
31 | -INVESALIUS_VERSION = "3.1.99996" | 31 | +INVESALIUS_VERSION = "3.1.99997" |
32 | 32 | ||
33 | INVESALIUS_ACTUAL_FORMAT_VERSION = 1.1 | 33 | INVESALIUS_ACTUAL_FORMAT_VERSION = 1.1 |
34 | 34 |
invesalius/gui/dialogs.py
@@ -1181,7 +1181,7 @@ def ShowAboutDialog(parent): | @@ -1181,7 +1181,7 @@ def ShowAboutDialog(parent): | ||
1181 | info = AboutDialogInfo() | 1181 | info = AboutDialogInfo() |
1182 | info.Name = "InVesalius" | 1182 | info.Name = "InVesalius" |
1183 | info.Version = const.INVESALIUS_VERSION | 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 | 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)) | 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 | # _("InVesalius is a software for medical imaging 3D reconstruction. ")+\ | 1187 | # _("InVesalius is a software for medical imaging 3D reconstruction. ")+\ |