27#include <wx/stdpaths.h>
28#include <wx/propgrid/advprops.h>
33#include <wx/fileconf.h>
34#include <wx/wfstream.h>
35#include <wx/sstream.h>
36#include <wx/filepicker.h>
51 wxXmlResource::Get()->LoadDialog(
this,
parent,
"select_dir_dialog");
60 if (
config->HasEntry(
"/ToolboxFrame/Stacker/AddDirRecursive"))
65 if (
config->HasEntry(
"/ToolboxFrame/Stacker/AddDirFilenames"))
71 if (
config->HasEntry(
"/ToolboxFrame/Stacker/AddDirFileType"))
84 void OnOk(wxCommandEvent& e)
95 if (filename.IsEmpty())
160 if (file.GetExt().CmpNoCase(
"jpg") == 0 ||
161 file.GetExt().CmpNoCase(
"jpeg") == 0 ||
162 file.GetExt().CmpNoCase(
"tif") == 0 ||
163 file.GetExt().CmpNoCase(
"tiff") == 0 ||
164 file.GetExt().CmpNoCase(
"png") == 0 ||
165 file.GetExt().CmpNoCase(
"bmp") == 0 ||
166 file.GetExt().CmpNoCase(
"gif") == 0 ||
167 file.GetExt().CmpNoCase(
"pnm") == 0 ||
168 file.GetExt().CmpNoCase(
"sun") == 0 ||
169 file.GetExt().CmpNoCase(
"hdr") == 0 ||
170 file.GetExt().CmpNoCase(
"viff") == 0)
172 files.push_back(file.GetFullPath());
178 for (
auto& f : files)
197 config->Write(
"/ToolboxFrame/Stacker/Sigma",
m_sigma->GetValue());
201 config->Write(wxString::Format(
"/ToolboxFrame/Stacker/FileListColumnWidth%d",
j),
m_fileListCtrl->GetColumnWidth(
j));
222 wxXmlResource::Get()->LoadPanel(
this,
"stacker_panel");
223 wxXmlResource::Get()->AttachUnknownControl(
"stacker_preview_window",
m_preview,
this);
246 if (
config->HasEntry(
"/ToolboxFrame/Stacker/Splitter"))
252 m_sigma->SetValue(
config->ReadDouble(
"/ToolboxFrame/Stacker/Sigma", 2));
258 int width =
config->Read(wxString::Format(
"/ToolboxFrame/Stacker/FileListColumnWidth%d",
j), -1);
264 m_sortCol =
config->Read(
"/ToolboxFrame/Stacker/FileListSortColumn", -1);
297 vigra::ImageImportInfo info(fullFilename.GetFullPath().c_str());
298 vigra::Size2D imageSize = info.getCanvasSize();
299 if (imageSize.area() == 0)
301 imageSize = info.size();
304 m_files.push_back(
FileInfo(fullFilename.GetFullPath(), fullFilename.GetFullName(), fullFilename.GetPath(), imageSize.width(), imageSize.height()));
315 dlg.SetDirectory(path);
319 if (
config->HasEntry(
"lastImageType"))
324 dlg.SetFilterIndex(0);
326 dlg.SetFilterIndex(1);
328 dlg.SetFilterIndex(2);
330 dlg.SetFilterIndex(3);
332 dlg.SetFilterIndex(4);
334 dlg.SetFilterIndex(5);
335 else if (
img_ext ==
"all files")
336 dlg.SetFilterIndex(6);
345 config->Write(
"/actualPath",
dlg.GetDirectory());
347 switch (
dlg.GetFilterIndex())
349 case 0:
config->Write(
"lastImageType",
"all images");
break;
350 case 1:
config->Write(
"lastImageType",
"jpg");
break;
351 case 2:
config->Write(
"lastImageType",
"tiff");
break;
352 case 3:
config->Write(
"lastImageType",
"png");
break;
353 case 4:
config->Write(
"lastImageType",
"hdr");
break;
354 case 5:
config->Write(
"lastImageType",
"exr");
break;
355 case 6:
config->Write(
"lastImageType",
"all files");
break;
419 if (e.GetKeyCode() == 1 && e.CmdDown())
464 const int newCol = e.GetColumn();
539 exiftoolArgs.Append(
" -all:all --thumbnail --thumbnailimage --xposition --yposition --imagefullwidth --imagefullheight ");
556 dlg.SetDirectory(path);
560 if (
config->HasEntry(
"lastImageType"))
566 dlg.SetFilterIndex(0);
572 dlg.SetFilterIndex(1);
578 dlg.SetFilterIndex(2);
591 config->Write(
"/actualPath",
dlg.GetDirectory());
593 switch (
dlg.GetFilterIndex())
596 config->Write(
"lastImageType",
"jpg");
599 config->Write(
"lastImageType",
"tiff");
602 config->Write(
"lastImageType",
"png");
613 switch (e.GetSelection())
666 switch (
XRCCTRL(*
this,
"stacker_mode_choice",
wxChoice)->GetSelection())
827#define SORTASCENDING(functionName, var) \
828int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
830 StackerPanel::FileInfoVector* data = (StackerPanel::FileInfoVector*)(sortData);\
831 if (data->at(item1).var > data->at(item2).var)\
833 if (data->at(item1).var < data->at(item2).var)\
838#define SORTDESCENDING(functionName, var) \
839int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
841 StackerPanel::FileInfoVector* data = (StackerPanel::FileInfoVector*)(sortData); \
842 if (data->at(item1).var < data->at(item2).var)\
844 if (data->at(item1).var > data->at(item2).var)\
Definition of dialog class to create brighter/darker versions of the image.
basic classes and function for queuing commands in wxWidgets
#define SORTDESCENDING(functionName, var)
#define SORTASCENDING(functionName, var)
declaration of panel for stacker GUI
normal command for queue, processing is stopped if an error occurred in program
optional command for queue, processing of queue is always continued, also if an error occurred
int ExecQueue(HuginQueue::CommandQueue *queue)
void AddString(const wxString &s)
display the string in the panel
int ExecWithRedirect(wxString command)
void ClearOutput()
clear the output
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
create the control
void setImage(const wxString &filename)
set the current image and mask list, this loads also the image from cache
void setScale(double factor)
set the scaling factor f.
dialog for selection of directory and file name/type
wxTextCtrl * m_filenameCtrl
wxArrayString GetFilenames()
wxDirPickerCtrl * m_dirPicker
SelectDirectoryFileDialog(wxWindow *parent)
Constructor, read from xrc ressource; restore last uses settings, size and position.
wxChoice * m_filetypeChoice
wxCheckBox * m_recursiveCheck
void OnOk(wxCommandEvent &e)
wxArrayString m_filenames
wxArrayString m_filetypeExtensions
void FillFileTypeChoice()
file drag and drop handler method
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
StackerPanel * m_stackerPanel
StackerDropTarget(StackerPanel *parent)
void OnRemoveFile(wxCommandEvent &e)
void SortList()
sort filename list
PreviewWindow * m_preview
long GetCheckedItemCount() const
return the number of check images
void OnZoom(wxCommandEvent &e)
void AddFileInfo(const FileInfo &info)
void CleanUpTempFiles()
delete all temporary files, to be called mainly at end
void OnAddDirectory(wxCommandEvent &e)
wxSpinCtrlDouble * m_winsorTrim
void OnFileColumnHeaderClick(wxListEvent &e)
void OnProcessFinished(wxCommandEvent &e)
call at the end of the enfuse command, to load result back and enable buttons again
void OnFileCheckStateChanged(wxListEvent &e)
void ExecuteStackerExiftool()
build the command line and execute enfuse and exiftool afterwards
wxListCtrl * m_fileListCtrl
wxSpinCtrl * m_sigmaMaxIter
void EnableOutputButtons(bool enable)
enable/disable output buttons
void OnFileListChar(wxKeyEvent &e)
bool Create(wxWindow *parent, MyExecPanel *logPanel)
creates the control and populates all controls with their settings
void OnModeChanged(wxCommandEvent &e)
void FillFileList()
fill the list from internal file list
void AddFile(const wxString &filename)
adds the given file to the list
wxArrayString m_outputFilenames
void EnableFileButtons()
enable/disable the file(s) remove and create buttons depending on selection of wxListCtrl
MyExecPanel * m_logWindow
void ExecuteStacker()
build the command line and execute enfuse command
void OnGenerateOutput(wxCommandEvent &e)
wxString GetStackerOptions()
build string with all stacker options from values in wxPropertyGrid this are the mainly the fusion op...
void OnGeneratePreview(wxCommandEvent &e)
~StackerPanel()
destructor, save state and settings
wxArrayString m_tempFiles
void OnAddFiles(wxCommandEvent &e)
event handler
wxString GetStackerCommandLine()
get the full commandline for enfuse without program, but with files and output options,...
void OnFileSelectionChanged(wxCommandEvent &e)
wxSpinCtrlDouble * m_sigma
std::set< unsigned int > UIntSet
str wxEscapeFilename(const str &arg)
special escaping routine for CommandQueues
wxString GetExternalProgram(wxConfigBase *config, const wxString &bindir, const wxString &name)
return path and name of external program, which can be overwritten by the user
std::vector< NormalCommand * > CommandQueue
wxString GetInternalProgram(const wxString &bindir, const wxString &name)
return path and name of external program, which comes bundled with Hugin
const wxString GetConfigTempDir(const wxConfigBase *config)
return the temp dir from the preferences, ensure that it ends with path separator
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.