GUI Batch Denoise for Renderman

General / 21 July 2020



How the GUI Denoise works:

  1. Search for the first image in a sequence that you would like to be denoised.
  2. Then press the "Create Denoise Script" to create a script file in the folder the images are located called "run_denoise"
  3. Reads the list of files.
  4. Creates a duplicated denoised list of exr files in numerical order and renames "variance" as "filtered".

Open this link in QT4 Designer to run the code:

https://sdm.scad.edu/faculty/mkesson/tech312/wip/best/winter2020/rachel_howard/batch_denoise_gui/demo.ui

Python code:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic      import sys
import os
import math
import os.path
import run_denoise
reload(run_denoise)
#from connection_utils import *      #________________________________________________________ #                     Widget Names #________________________________________________________ #
#                       doit_Button #       

from PyQt4.QtCore import *

from PyQt4.QtGui import *

from PyQt4 import uic

  

    

import sys

import os

import math

import os.path

import run_denoise

reload(run_denoise)

#from connection_utils import *

  

  

  

#________________________________________________________

#                     Widget Names

#________________________________________________________

#

#                       doit_Button

#                        search_button

#                        exr_pathLine

#                        exr_nameLine

#                        confirmation_Line

#                        headericon_Label

#________________________________________________________

class DemoDialog(QDialog):

    def __init__(self, parent=None):

        super(DemoDialog, self).__init__(parent)

        pathToUi = os.path.join(os.path.dirname(__file__), 'ui', 'demo.ui')

        self.ui = uic.loadUi(pathToUi,self)

    #------------------------------------------------------------------------------------------

        self.pathToHeaderIcon = os.path.join(os.path.dirname(__file__), 'icons', 'header_image.jpg')

    #------------------------------------------------------------------------------------------

        self.setWindowFlags(Qt.WindowStaysOnTopHint)

        self.makeConnections()

        self.ui.show()    

    #________________________________________________

    def makeConnections(self):

        #------------------------------------------------------------------------------------------

        pixmap = QPixmap(self.pathToHeaderIcon)

        pixmap_resized = pixmap.scaled(400, 405)

        self.ui.headerIcon_Label.setPixmap(pixmap_resized)

        self.ui.headerIcon_Label.setMask(pixmap_resized.mask())

        self.ui.setFixedSize(421, 600) # optional

        #------------------------------------------------------------------------------------------

        self.ui.doit_Button.clicked.connect(self.doitAction)

        self.exr_nameLine = self.ui.exr_nameLine

        self.exr_pathLine = self.ui.exr_pathLine #QLineEdit

        self.search_button = self.ui.search_button.clicked.connect(self.openFileDialogAction)

        

    #________________________________________________

    def openFileDialogAction(self):

        fullpath = QFileDialog.getOpenFileName(self,("Open"), "/home/rhowar24/mount/stuhome/tech312", ("EXR Files (*.exr)"))

        #we want the path to the exr folder and the name of an exr file        

        self.exr_path = os.path.dirname( str(fullpath))

        self.exr_name = os.path.basename( str(fullpath))

        self.exr_pathLine.insert(self.exr_path)

        self.exr_nameLine.insert(self.exr_name)

  

    def doitAction(self):

        run_denoise.doit(self.exr_path,self.exr_name)

    

        self.confirmation_Line.clear()

        self.confirmation_Line.insert( 'Created "run_batch_denoise". Double click created script.')

        print script_path

         

        

#========================================================        

if __name__ == '__main__':

    app = QApplication(sys.argv)

    dialog = DemoDialog()

    dialog.show()

    sys.exit(app.exec_())


                 search_button #                        exr_pathLine #                        exr_nameLine #                        confirmation_Line #                        headericon_Label #________________________________________________________ # class DemoDialog(QDialog):    def __init__(self, parent=None):        super(DemoDialog, self).__init__(parent)        pathToUi = os.path.join(os.path.dirname(__file__), 'ui', 'demo.ui')        self.ui = uic.loadUi(pathToUi,self)    #------------------------------------------------------------------------------------------        self.pathToHeaderIcon = os.path.join(os.path.dirname(__file__), 'icons', 'header_image.jpg')    #------------------------------------------------------------------------------------------        self.setWindowFlags(Qt.WindowStaysOnTopHint)        self.makeConnections()        self.ui.show()        #________________________________________________    def makeConnections(self):        #------------------------------------------------------------------------------------------        pixmap = QPixmap(self.pathToHeaderIcon)        pixmap_resized = pixmap.scaled(400, 405)        self.ui.headerIcon_Label.setPixmap(pixmap_resized)        self.ui.headerIcon_Label.setMask(pixmap_resized.mask())        self.ui.setFixedSize(421, 600) # optional        #------------------------------------------------------------------------------------------        self.ui.doit_Button.clicked.connect(self.doitAction)        self.exr_nameLine = self.ui.exr_nameLine        self.exr_pathLine = self.ui.exr_pathLine #QLineEdit        self.search_button = self.ui.search_button.clicked.connect(self.openFileDialogAction)            #________________________________________________    def openFileDialogAction(self):        fullpath = QFileDialog.getOpenFileName(self,("Open"), "/home/rhowar24/mount/stuhome/tech312", ("EXR Files (*.exr)"))        #we want the path to the exr folder and the name of an exr file                self.exr_path = os.path.dirname( str(fullpath))        self.exr_name = os.path.basename( str(fullpath))        self.exr_pathLine.insert(self.exr_path)        self.exr_nameLine.insert(self.exr_name)      def doitAction(self):        run_denoise.doit(self.exr_path,self.exr_name)            self.confirmation_Line.clear()        self.confirmation_Line.insert( 'Created "run_batch_denoise". Double click created script.')        print script_path                 #========================================================        if __name__ == '__main__':    app = QApplication(sys.argv)    dialog = DemoDialog()    dialog.show()    sys.exit(app.exec_())


QT4 Designer GUI Layout: