예제 #1
0
 def _processImage(self):
     wt = WaitProcess
     wt.run()
     wt.change_value(50)
     wt.change_info("Procesando imagen")
     Application.processImage()
     wt.change_value(80)
     wt.change_info("Visualizando datos")
     #actualizar la vista de los tres planos de la imagen procesada
     self._processed_planes.Image = Application.get_processed_image()
     self._filters_ui_synchronizer._update_filters_properties()
     wt.stop()
예제 #2
0
    def _calculate_data(self):
        img = Application.get_processed_image()
        if img is None:
            return

        self._ui.calculate.setEnabled(False)

        writer = itk.ImageFileWriter[
            img.ImageType].New()  #crear el writer de ITK
        writer.SetFileName(
            self._temp_file_path)  #ponerle el nombre seleccionado
        writer.SetInput(img.InternalImage)  #conectar la imagen a guardar
        writer.Update()  #guardar la imagen!

        subprocess.call([
            self._volume_exec_path, self._temp_file_path,
            self._volume_file_path
        ])
        #os.system('"'+self._volume_exec_path+'" "'+self._temp_file_path+'" '+self._volume_file_path)

        spc = img.Spacing
        spc_factor = spc[0] * spc[1] * spc[2]

        f = open(self._volume_file_path, 'rt')
        try:
            self._vol = float(f.readline()) * spc_factor

            self._lenX = float(f.readline()) * spc[0]
            self._startX = map(int, f.readline()[1:-2].split(", "))
            self._endX = map(int, f.readline()[1:-2].split(", "))

            self._lenY = float(f.readline()) * spc[1]
            self._startY = map(int, f.readline()[1:-2].split(", "))
            self._endY = map(int, f.readline()[1:-2].split(", "))

            self._lenZ = float(f.readline()) * spc[2]
            self._startZ = map(int, f.readline()[1:-2].split(", "))
            self._endZ = map(int, f.readline()[1:-2].split(", "))
        finally:
            f.close()

        self._update_labels()
        self._ui.calculate.setEnabled(True)
        self._ui.save.setEnabled(True)
예제 #3
0
 def _save_image(self):
     img_svr = ImageSaver()  #crear el diálogo
     img_svr.saveImage(Application.get_processed_image())  #salvar la imagen