54752cfa38468abbab5580fae1a718bb41fe3f31,ilastik/applets/dataSelection/dataSelectionGui.py,DataSelectionGui,handleAddStack,#DataSelectionGui#Any#,289

Before Change


        The user clicked the "Import Stack Files" button.
        
        // Find the directory of the most recently opened image file
        mostRecentStackImageFile = PreferencesManager().get( "DataSelection", "recent stack image" )
        if mostRecentStackImageFile is not None:
            defaultDirectory = os.path.split(mostRecentStackImageFile)[0]
        else:
            defaultDirectory = os.path.expanduser("~")

        // Launch the "Open File" dialog
        fileNames = self.getImageFileNamesToOpen(defaultDirectory)

        if len(fileNames) == 1:
            QMessageBox.warning(self, "Invalid selection", "Cannot create stack: You only selected one file.  If your stack is contained in a single file (e.g. a multi-page tiff or hdf5 volume), please use the "Add File" button." )
            return

After Change


        
        stackDlg = StackFileSelectionWidget(self)
        stackDlg.exec_()
        if stackDlg.result() != QDialog.Accepted :
            return
        files = stackDlg.selectedFiles
        if len(files) == 0:
            return

        info = DatasetInfo()
        info.filePath = "//".join( files )

        // Allow labels by default if this gui isn"t being used for batch data.
        info.allowLabels = ( self.guiMode == GuiMode.Normal )

        laneIndex = self._findFirstEmptyLane(roleIndex)
        if len(self.topLevelOperator.DatasetGroup) < laneIndex+1:
            self.topLevelOperator.DatasetGroup.resize(laneIndex+1)

        def importStack():
            self.guiControlSignal.emit( ControlCommand.DisableAll )
            // Serializer will update the operator for us, which will propagate to the GUI.
            try:
                self.serializer.importStackAsLocalDataset( info )
                self.topLevelOperator.DatasetGroup[laneIndex][roleIndex].setValue(info)
            
            finally:
                self.guiControlSignal.emit( ControlCommand.Pop )

        req = Request( importStack )
        req.notify_failed( partial(self.handleFailedStackLoad, files ) )
        req.submit()

    @threadRouted
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: ilastik/ilastik
Commit Name: 54752cfa38468abbab5580fae1a718bb41fe3f31
Time: 2013-04-19
Author: bergs@janelia.hhmi.org
File Name: ilastik/applets/dataSelection/dataSelectionGui.py
Class Name: DataSelectionGui
Method Name: handleAddStack


Project Name: catalyst-team/catalyst
Commit Name: e9905e975cbaf0c71fd7e9aab113e196122c6027
Time: 2020-01-27
Author: tez.romach@gmail.com
File Name: catalyst/dl/utils/criterion/iou.py
Class Name:
Method Name: iou