Exemplo n.º 1
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        print("ENTERING input_select")
        self.new_key()
        self.init_cfg()
        print("key = " + self.key)
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]
        # get the images
        input_dict = config.file_dict(self.input_dir)
        idir = self.input_dir + input_dict[input_id]['subdir'] + '/'
        print("idir = " + idir)
        fnames = [os.path.basename(f) for f in glob.glob(idir + 'i????.png')]
        for f in fnames:
            shutil.copy(idir + f, self.work_dir + f)
        hastruth = os.path.isfile(idir + "a.png")
        self.cfg['meta']['hastruth'] = hastruth
        self.cfg['meta']['maxframes'] = len(fnames)
        if (hastruth):
            shutil.copy(idir + "a.png", self.work_dir + "a.png")

        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['height'] = image(self.work_dir + '/i0000.png').size[1]
        self.cfg.save()
        # jump to the params page
        return self.params(msg="(no message)", key=self.key)
Exemplo n.º 2
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        #print("ENTERING input_select")
        self.new_key()
        self.init_cfg()
        #print("key = " + self.key)
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]
        # get the images
        input_dict = config.file_dict(self.input_dir)
        idir = self.input_dir + input_dict[input_id]['subdir'] + '/'
        #print("idir = " + idir)
        fnames = [os.path.basename(f) for f in glob.glob(idir + 'i????.png')]
        for f in fnames:
            shutil.copy(idir + f, self.work_dir + f)
        hastruth = os.path.isfile(idir + "a.png")
        self.cfg['meta']['hastruth'] = hastruth
        self.cfg['meta']['maxframes'] = len(fnames)
        if (hastruth):
            shutil.copy(idir + "a.png", self.work_dir + "a.png")

        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['height'] = image(self.work_dir +
                                           '/i0000.png').size[1]
        self.cfg.save()
        # jump to the params page
        return self.params(msg="(no message)", key=self.key)
Exemplo n.º 3
0
    def index(self):
        """
        demo presentation and input menu
        """
        print("ENTERING index")
        tn_size = 192
        # read the input index as a dict
        inputd = config.file_dict(self.input_dir)
        print(inputd)
        for (input_id, input_info) in inputd.items():
            fname = ["a.png", "b.png", "t.png"]
            tn_fname = [thumbnail(self.input_dir + \
                 input_info['subdir'] \
                           + '/a.png',(tn_size,tn_size))]
            inputd[input_id]['hastruth'] = os.path.isfile(
                self.input_dir + input_info['subdir']+'/t.tiff')
            inputd[input_id]['height'] = image(self.input_dir
                       + input_info['subdir'] + '/a.png').size[1]
            inputd[input_id]['baseinput'] = \
                self.input_url + input_info['subdir'] + '/'
            inputd[input_id]['url'] = [self.input_url
                            + input_info['subdir']
                    + '/' + os.path.basename(f)
                  for f in fname]
            inputd[input_id]['tn_url'] = [self.input_url
                         + input_info['subdir']
                         + '/'
                         + os.path.basename(f)
                 for f in tn_fname]

        return self.tmpl_out("input.html", inputd=inputd)
Exemplo n.º 4
0
 def input_select(self, **kwargs):
     """
     use the selected available input images
     """
     self.init_cfg()
     #kwargs contains input_id.x and input_id.y
     input_id = kwargs.keys()[0].split('.')[0]
     assert input_id == kwargs.keys()[1].split('.')[0]
     # get the images
     input_dict = config.file_dict(self.input_dir)
     fnames = input_dict[input_id]['files'].split()
     for i in range(len(fnames)):
         shutil.copy(self.input_dir + fnames[i],
                     self.work_dir + 'input_%i' % i)
     if input_dict[input_id]['type'] == "3d":
         fnames = input_dict[input_id]['volume'].split()
         for i in range(len(fnames)):
             shutil.copy(self.input_dir + fnames[i],
                         self.work_dir + 'inputVol_%i' % i + '.vol')
     msg = self.process_input()
     self.log("input selected : %s" % input_id)
     self.cfg['meta']['original'] = False
     self.cfg['meta']['is3d'] = input_dict[input_id]['type'] == "3d"
     self.cfg.save()
     # jump to the params page
     return self.params(msg=msg, key=self.key)
Exemplo n.º 5
0
    def index(self):
        """
        demo presentation and input menu
        """
        # read the input index as a dict
        inputd = config.file_dict(self.input_dir)
        tn_size = int(cherrypy.config.get('input.thumbnail.size', '192'))
        # TODO: build via list-comprehension
        for (input_id, input_info) in inputd.items():
            # convert the files to a list of file names
            # by splitting at blank characters
            # and generate thumbnails and thumbnail urls
            fname = input_info['files'].split()
#           GENERATE THUMBNAIL EVEN FOR FILES IN SUBDIRECTORIES OF INPUT
            inputd[input_id]['tn_url'] = [self.input_url +'/'+ os.path.dirname(f) + '/' +
                        os.path.basename(thumbnail(self.input_dir + f, (tn_size, tn_size)))
                        for f in fname]
            inputd[input_id]['url'] = [self.input_url + os.path.basename(f)
                                       for f in fname]
#            tn_fname = [thumbnail(self.input_dir + f, (tn_size, tn_size))
#                        for f in fname]
#            inputd[input_id]['url'] = [self.input_url + os.path.basename(f)
#                                       for f in fname]
#            inputd[input_id]['tn_url'] = [self.input_url + os.path.basename(f)
#                                          for f in tn_fname]


        return self.tmpl_out("input.html",
                             inputd=inputd)
Exemplo n.º 6
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        print("ENTERING input_select")
        self.new_key()
        self.init_cfg()
        print("key = " + self.key)
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]
        # get the images
        input_dict = config.file_dict(self.input_dir)
        idir = self.input_dir + input_dict[input_id]['subdir'] + '/'
        fnames = "a.png b.png".split()
        for f in fnames:
            shutil.copy(idir + f, self.work_dir + f)
        hastruth = os.path.isfile(idir + "t.tiff")
        self.cfg['meta']['hastruth'] = hastruth
        if (hastruth):
            shutil.copy(idir + "t.tiff", self.work_dir + "t.tiff")
            shutil.copy(idir + "t.png", self.work_dir + "t.png")

        #fnames = input_dict[input_id]['files'].split()
        #for i in range(len(fnames)):
        #    shutil.copy(self.input_dir + fnames[i],
        #                self.work_dir + 'input_%i' % i)
        #msg = self.process_input()
        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['height'] = image(self.work_dir + '/a.png').size[1]
        self.cfg.save()
        # jump to the params page
        return self.params(msg="(no message)", key=self.key)
Exemplo n.º 7
0
    def index(self):
        """
        demo presentation and input menu
        """
        # read the input index as a dict
        inputd = config.file_dict(self.input_dir)
        tn_size = int(cherrypy.config.get('input.thumbnail.size', '192'))
        # TODO: build via list-comprehension
        for (input_id, input_info) in inputd.items():
            # convert the files to a list of file names
            # by splitting at blank characters
            # and generate thumbnails and thumbnail urls
            fname = input_info['files'].split()
            #           GENERATE THUMBNAIL EVEN FOR FILES IN SUBDIRECTORIES OF INPUT
            inputd[input_id]['tn_url'] = [
                self.input_url + '/' + os.path.dirname(f) + '/' +
                os.path.basename(
                    thumbnail(self.input_dir + f, (tn_size, tn_size)))
                for f in fname
            ]
            inputd[input_id]['url'] = [
                self.input_url + os.path.basename(f) for f in fname
            ]

        return self.tmpl_out("input.html", inputd=inputd)
Exemplo n.º 8
0
 def input_select(self, **kwargs):
     """
     use the selected available input images
     """
     self.init_cfg()
     #kwargs contains input_id.x and input_id.y
     input_id = kwargs.keys()[0].split('.')[0]
     assert input_id == kwargs.keys()[1].split('.')[0]
     # get the images
     input_dict = config.file_dict(self.input_dir)
     fnames = input_dict[input_id]['files'].split()
     for i in range(len(fnames)):
         shutil.copy(self.input_dir + fnames[i],
                     self.work_dir + 'input_%i' % i)
     if input_dict[input_id]['type'] == "3d":
         fnames = input_dict[input_id]['volume'].split()
         for i in range(len(fnames)):
             shutil.copy(self.input_dir + fnames[i],
                         self.work_dir + 'inputVol_%i' % i +'.vol')
     msg = self.process_input()
     self.log("input selected : %s" % input_id)
     self.cfg['meta']['original'] = False
     self.cfg['meta']['is3d'] = input_dict[input_id]['type'] == "3d"
     self.cfg.save()
     # jump to the params page
     return self.params(msg=msg, key=self.key)
Exemplo n.º 9
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        print("ENTERING input_select")
        self.new_key()
        self.init_cfg()
        print("key = " + self.key)
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]
        # get the images
        input_dict = config.file_dict(self.input_dir)
        idir = self.input_dir + input_dict[input_id]['subdir'] + '/'
        fnames = "a.png b.png".split()
        for f in fnames:
            shutil.copy(idir + f, self.work_dir + f)
        hastruth = os.path.isfile(idir + "t.tiff")
        self.cfg['meta']['hastruth'] = hastruth
        if (hastruth):
            shutil.copy(idir + "t.tiff", self.work_dir + "t.tiff")
            shutil.copy(idir + "t.png", self.work_dir + "t.png")

        #fnames = input_dict[input_id]['files'].split()
        #for i in range(len(fnames)):
        #    shutil.copy(self.input_dir + fnames[i],
        #                self.work_dir + 'input_%i' % i)
        #msg = self.process_input()
        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['height'] = image(self.work_dir + '/a.png').size[1]
        self.cfg.save()
        # jump to the params page
        return self.params(msg="(no message)", key=self.key)
Exemplo n.º 10
0
    def index(self):
        """
        demo presentation and input menu
        """
        #print("ENTERING index")
        tn_size = 192
        # read the input index as a dict
        inputd = config.file_dict(self.input_dir)
        #print(inputd)
        for (input_id, input_info) in inputd.items():
            tn_fname = [thumbnail(self.input_dir + \
                                     input_info['subdir'] \
                                     + '/i0000.png',(tn_size,tn_size))]
            inputd[input_id]['hastruth'] = os.path.isfile(
                self.input_dir + input_info['subdir'] + '/a.png')
            inputd[input_id]['height'] = image(self.input_dir +
                                               input_info['subdir'] +
                                               '/i0000.png').size[1]
            inputd[input_id]['baseinput'] = \
                        self.input_url + input_info['subdir'] + '/'
            inputd[input_id]['url'] = [
                self.input_url + input_info['subdir'] + '/' +
                os.path.basename(f) for f in ["i0000.png"]
            ]
            inputd[input_id]['tn_url'] = [
                self.input_url + input_info['subdir'] + '/' +
                os.path.basename(f) for f in tn_fname
            ]

        return self.tmpl_out("input.html", inputd=inputd)
Exemplo n.º 11
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        # When we arrive here, self.key should be empty.
        # If not, it means that the execution belongs to another thread
        # and therefore we need to reuse the app object
        key_is_empty = (self.key == "")
        if key_is_empty:
            # New execution: create new app object
            self2 = base_app(self.base_dir)
            self2.__class__ = self.__class__
            self2.__dict__.update(self.__dict__)
        else:
            # Already known execution
            self2 = self

        self2.new_key()
        self2.init_cfg()

        # Add app to object pool
        if key_is_empty:
            pool = AppPool.get_instance() # Singleton pattern
            pool.add_app(self2.key, self2)

        # custom roi_max, passed by the user directly in the URL
        roi_max = 1000
        if 'roi_max' in kwargs:
            roi_max = int(kwargs['roi_max'])
            kwargs.pop('roi_max')

        # get the dataset id
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]

        # save paths to the tiff images
        # either one of the two keys dzi8 or dzi16 must exist
        input_dict = config.file_dict(self2.input_dir)
        self2.cfg['param']['tif_paths'] = input_dict[input_id]['tif'].split()
        self2.cfg['param']['nb_images'] = len(input_dict[input_id]['tif'].split())
        if input_dict[input_id].has_key('dzi8'):
            self2.cfg['param']['dzi_paths'] = input_dict[input_id]['dzi8'].split()
        else:
            self2.cfg['param']['dzi_paths'] = input_dict[input_id]['dzi16'].split()
        self2.cfg.save()

        # jump to the display page
        return self2.params(key=self2.key, roi_max=roi_max)
Exemplo n.º 12
0
 def input_select(self, **kwargs):
     """
     After this method has run, the images have been:
     downloaded, converted and renamed to standard names
     IF the ground truth is provided, then the mask images
     are also generated
     The format for the images is PNG, except for the ground truth, which is encoded as TIFF
     A PNG thumbnail of the ground truth is also generated
     """
     from lib import config
     import urlparse
     
     self.new_key()
     self.init_cfg()
     
     # get parameters for the preconfigured experiments
     # kwargs contains input_id.x and input_id.y
     # The html form uses the input identifiers as names of the field
     input_id = kwargs.keys()[0].split('.')[0]
     assert input_id == kwargs.keys()[1].split('.')[0]
     
     # load the input.cfg either from a local path or from an url
     input_cfg_path = config.file_dict(self.input_dir)[input_id]['path']
     
     if urlparse.urlparse(input_cfg_path).netloc == '':
         # it should be a relative path
         cfg_path_or_url = os.path.join(self.base_dir,'input',input_cfg_path , 'param.cfg')
         self.copy_cfg_from_path(cfg_path_or_url,  self.work_dir)
     else: 
        # it is an url
        cfg_path_or_url = urlparse.urljoin(input_cfg_path , 'param.cfg')
        self.download_cfg_from_url(cfg_path_or_url, self.work_dir)
 
     # download the files_url, that may be left from both cases
     self.download_remaining_url_files(self.work_dir)
 
     # process the input files
     msg = self.process_input_files()
 
 
     self.log("input selected : %s" % input_id)
     self.cfg['meta']['input_id'] = input_id
     self.cfg['meta']['original'] = False
     self.cfg.save()
     
     # jump to the params page
     return self.params(msg=msg, key=self.key)
Exemplo n.º 13
0
    def input_select(self, **kwargs):
        """
        After this method has run, the images have been:
        downloaded, converted and renamed to standard names
        IF the ground truth is provided, then the mask images
        are also generated
        The format for the images is PNG, except for the ground truth, which is encoded as TIFF
        A PNG thumbnail of the ground truth is also generated
        """
        from lib import config
        import urlparse

        self.new_key()
        self.init_cfg()

        # get parameters for the preconfigured experiments
        # kwargs contains input_id.x and input_id.y
        # The html form uses the input identifiers as names of the field
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]

        # load the input.cfg either from a local path or from an url
        input_cfg_path = config.file_dict(self.input_dir)[input_id]['path']

        if urlparse.urlparse(input_cfg_path).netloc == '':
            # it should be a relative path
            cfg_path_or_url = os.path.join(self.base_dir, 'input',
                                           input_cfg_path, 'param.cfg')
            self.copy_cfg_from_path(cfg_path_or_url, self.work_dir)
        else:
            # it is an url
            cfg_path_or_url = urlparse.urljoin(input_cfg_path, 'param.cfg')
            self.download_cfg_from_url(cfg_path_or_url, self.work_dir)

        # download the files_url, that may be left from both cases
        self.download_remaining_url_files(self.work_dir)

        # process the input files
        msg = self.process_input_files()

        self.log("input selected : %s" % input_id)
        self.cfg['meta']['input_id'] = input_id
        self.cfg['meta']['original'] = False
        self.cfg.save()

        # jump to the params page
        return self.params(msg=msg, key=self.key)
Exemplo n.º 14
0
	def index(self):
		"""
		demo presentation and input menu
		"""
		print("ENTERING index")
		# read the input index as a dict
		inputd = config.file_dict(self.input_dir)
		print(inputd)
		for (input_id, input_info) in inputd.items():
			fname = ["a.png", "b.png", "t.png"]
			inputd[input_id]['baseinput'] = self.input_url + input_info['subdir']+'/'
			inputd[input_id]['url'] = [self.input_url
				  	        + input_info['subdir']
					+ '/' + os.path.basename(f)
			      for f in fname]
			inputd[input_id]['tn_url'] = [self.input_url
						 + input_info['subdir']
						 + '/'
						 + os.path.basename(f)
				 for f in fname]

		return self.tmpl_out("input.html", inputd=inputd)
Exemplo n.º 15
0
    def get_params_from_url(self, input_id=None, x=None, y=None, r=None, n_bins= None, sigma=None):
        """
        redirects to the wait method with the provided parameters
        This method was made only to be able to launch one precise experiment from one url
        """
        self.new_key()
        self.init_cfg()

        # get the images
        input_dict = config.file_dict(self.input_dir)
        fnames = input_dict[input_id]['files'].split()
        for i in range(len(fnames)):
            shutil.copy(self.input_dir + fnames[i],
                        self.work_dir + 'input_%i' % i)
        msg = self.process_input()
        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['input_id'] = input_id
        self.cfg.save()

        # jump to the wait page
        return self.wait(key=self.key, newrun=False, xold="0", yold="0",
                          x=x, y=y, r=r, sigma=sigma, n_bins=n_bins)
Exemplo n.º 16
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        # When we arrive here, self.key should be empty.
        # If not, it means that the execution belongs to another thread
        # and therefore we need to reuse the app object
        key_is_empty = (self.key == "")
        if key_is_empty:
            # New execution: create new app object
            self2 = base_app(self.base_dir)
            self2.__class__ = self.__class__
            self2.__dict__.update(self.__dict__)
        else:
            # Already known execution
            self2 = self

        self2.new_key()
        self2.init_cfg()

        # Add app to object pool
        if key_is_empty:
            pool = AppPool.get_instance()  # Singleton pattern
            pool.add_app(self2.key, self2)

        # custom roi_max, passed by the user directly in the URL
        roi_max = 1000
        if 'roi_max' in kwargs:
            roi_max = int(kwargs['roi_max'])
            kwargs.pop('roi_max')

        # get the dataset id
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]

        # read the dictionary of inputs
        input_dict = config.file_dict(self.input_dir)

        # create symlinks to the full images and rpc files. There must be the
        # same number of image files and rpc files. The number of previews
        # doesn't matter.
        img_files = input_dict[input_id]['tif'].split()
        rpc_files = input_dict[input_id]['rpc'].split()
        assert len(img_files) == len(rpc_files)

        img_files_abs = [os.path.join(self.input_dir, f) for f in img_files]
        rpc_files_abs = [os.path.join(self.input_dir, f) for f in rpc_files]
        for i in range(len(img_files)):
            os.symlink(img_files_abs[i],
                       os.path.join(self.work_dir, 'img_%02d.tif' % (i + 1)))
            os.symlink(rpc_files_abs[i],
                       os.path.join(self.work_dir, 'rpc_%02d.xml' % (i + 1)))

        # if it's an xs dataset, create a link to the clr reference image
        if 'clr' in input_dict[input_id]:
            clr_files = input_dict[input_id]['clr'].split()
            clr_files_abs = [
                os.path.join(self.input_dir, f) for f in clr_files
            ]
            os.symlink(clr_files_abs[0],
                       os.path.join(self.work_dir, 'img_01_clr.tif'))

        # link to the preview files, needed by the archive
        prv_files = input_dict[input_id]['files'].split()
        prv_files_abs = [os.path.join(self.input_dir, f) for f in prv_files]
        for i, f in enumerate(prv_files_abs):
            os.symlink(f, os.path.join(self.work_dir,
                                       'prv_%02d.png' % (i + 1)))

        # save params of the dataset
        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['input_id'] = input_id
        self.cfg['meta']['nb_img'] = len(img_files)
        self.cfg['meta']['color'] = input_dict[input_id]['color']

        # either one of the two keys dzi8 or dzi16 must exist
        self.cfg['param']['tif_paths'] = input_dict[input_id]['tif'].split()
        if input_dict[input_id].has_key('dzi8'):
            self.cfg['param']['dzi_paths'] = input_dict[input_id][
                'dzi8'].split()
        else:
            self.cfg['param']['dzi_paths'] = input_dict[input_id][
                'dzi16'].split()
        self.cfg.save()

        # jump to the display page
        return self.params(key=self.key, roi_max=roi_max)
Exemplo n.º 17
0
    def input_select(self, **kwargs):
        """
        use the selected available input images
        """
        # When we arrive here, self.key should be empty.
        # If not, it means that the execution belongs to another thread
        # and therefore we need to reuse the app object
        key_is_empty = (self.key == "")
        if key_is_empty:
            # New execution: create new app object
            self2 = base_app(self.base_dir)
            self2.__class__ = self.__class__
            self2.__dict__.update(self.__dict__)
        else:
            # Already known execution
            self2 = self

        self2.new_key()
        self2.init_cfg()

        # Add app to object pool
        if key_is_empty:
            pool = AppPool.get_instance() # Singleton pattern
            pool.add_app(self2.key, self2)

        # custom roi_max, passed by the user directly in the URL
        roi_max = 1000
        if 'roi_max' in kwargs:
            roi_max = int(kwargs['roi_max'])
            kwargs.pop('roi_max')

        # get the dataset id
        # kwargs contains input_id.x and input_id.y
        input_id = kwargs.keys()[0].split('.')[0]
        assert input_id == kwargs.keys()[1].split('.')[0]

        # read the dictionary of inputs
        input_dict = config.file_dict(self.input_dir)

        # create symlinks to the full images and rpc files. There must be the
        # same number of image files and rpc files. The number of previews
        # doesn't matter.
        img_files = input_dict[input_id]['tif'].split()
        rpc_files = input_dict[input_id]['rpc'].split()
        assert len(img_files) == len(rpc_files)

        img_files_abs = [os.path.join(self.input_dir, f) for f in img_files]
        rpc_files_abs = [os.path.join(self.input_dir, f) for f in rpc_files]
        for i in range(len(img_files)):
            os.symlink(img_files_abs[i], os.path.join(self.work_dir,
                'img_%02d.tif' % (i+1)))
            os.symlink(rpc_files_abs[i], os.path.join(self.work_dir,
                'rpc_%02d.xml' % (i+1)))

        # if it's an xs dataset, create a link to the clr reference image
        if 'clr' in input_dict[input_id]:
            clr_files = input_dict[input_id]['clr'].split()
            clr_files_abs = [os.path.join(self.input_dir, f) for f in clr_files]
            os.symlink(clr_files_abs[0], os.path.join(self.work_dir, 'img_01_clr.tif'))

        # link to the preview files, needed by the archive
        prv_files = input_dict[input_id]['files'].split()
        prv_files_abs = [os.path.join(self.input_dir, f) for f in prv_files]
        for i, f in enumerate(prv_files_abs):
            os.symlink(f, os.path.join(self.work_dir, 'prv_%02d.png' % (i+1)))

        # save params of the dataset
        self.log("input selected : %s" % input_id)
        self.cfg['meta']['original'] = False
        self.cfg['meta']['input_id'] = input_id
        self.cfg['meta']['nb_img'] = len(img_files)
        self.cfg['meta']['color'] = input_dict[input_id]['color']

        # either one of the two keys dzi8 or dzi16 must exist
        self.cfg['param']['tif_paths'] = input_dict[input_id]['tif'].split()
        if input_dict[input_id].has_key('dzi8'):
            self.cfg['param']['dzi_paths'] = input_dict[input_id]['dzi8'].split()
        else:
            self.cfg['param']['dzi_paths'] = input_dict[input_id]['dzi16'].split()
        self.cfg.save()

        # jump to the display page
        return self.params(key=self.key, roi_max=roi_max)