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>
53 wxXmlResource::Get()->LoadDialog(
this,
parent,
"select_dir_dialog");
62 if (
config->HasEntry(
"/ToolboxFrame/Stacker/AddDirRecursive"))
67 if (
config->HasEntry(
"/ToolboxFrame/Stacker/AddDirFilenames"))
73 if (
config->HasEntry(
"/ToolboxFrame/Stacker/AddDirFileType"))
86 void OnOk(wxCommandEvent& e)
97 if (filename.IsEmpty())
162 if (file.GetExt().CmpNoCase(
"jpg") == 0 ||
163 file.GetExt().CmpNoCase(
"jpeg") == 0 ||
164 file.GetExt().CmpNoCase(
"tif") == 0 ||
165 file.GetExt().CmpNoCase(
"tiff") == 0 ||
166 file.GetExt().CmpNoCase(
"png") == 0 ||
167 file.GetExt().CmpNoCase(
"bmp") == 0 ||
168 file.GetExt().CmpNoCase(
"gif") == 0 ||
169 file.GetExt().CmpNoCase(
"pnm") == 0 ||
170 file.GetExt().CmpNoCase(
"sun") == 0 ||
171 file.GetExt().CmpNoCase(
"hdr") == 0 ||
172 file.GetExt().CmpNoCase(
"viff") == 0)
174 files.push_back(file.GetFullPath());
180 for (
auto& f : files)
199 config->Write(
"/ToolboxFrame/Stacker/Sigma",
m_sigma->GetValue());
203 config->Write(wxString::Format(
"/ToolboxFrame/Stacker/FileListColumnWidth%d",
j),
m_fileListCtrl->GetColumnWidth(
j));
224 wxXmlResource::Get()->LoadPanel(
this,
"stacker_panel");
225 wxXmlResource::Get()->AttachUnknownControl(
"stacker_preview_window",
m_preview,
this);
249 if (
config->HasEntry(
"/ToolboxFrame/Stacker/Splitter"))
255 m_sigma->SetValue(
config->ReadDouble(
"/ToolboxFrame/Stacker/Sigma", 2));
261 int width =
config->Read(wxString::Format(
"/ToolboxFrame/Stacker/FileListColumnWidth%d",
j), -1);
267 m_sortCol =
config->Read(
"/ToolboxFrame/Stacker/FileListSortColumn", -1);
300 vigra::ImageImportInfo info(fullFilename.GetFullPath().c_str());
301 vigra::Size2D imageSize = info.getCanvasSize();
302 if (imageSize.area() == 0)
304 imageSize = info.size();
307 m_files.push_back(
FileInfo(fullFilename.GetFullPath(), fullFilename.GetFullName(), fullFilename.GetPath(), imageSize.width(), imageSize.height()));
318 dlg.SetDirectory(path);
322 if (
config->HasEntry(
"lastImageType"))
327 dlg.SetFilterIndex(0);
329 dlg.SetFilterIndex(1);
331 dlg.SetFilterIndex(2);
333 dlg.SetFilterIndex(3);
335 dlg.SetFilterIndex(4);
337 dlg.SetFilterIndex(5);
338 else if (
img_ext ==
"all files")
339 dlg.SetFilterIndex(6);
348 config->Write(
"/actualPath",
dlg.GetDirectory());
350 switch (
dlg.GetFilterIndex())
352 case 0:
config->Write(
"lastImageType",
"all images");
break;
353 case 1:
config->Write(
"lastImageType",
"jpg");
break;
354 case 2:
config->Write(
"lastImageType",
"tiff");
break;
355 case 3:
config->Write(
"lastImageType",
"png");
break;
356 case 4:
config->Write(
"lastImageType",
"hdr");
break;
357 case 5:
config->Write(
"lastImageType",
"exr");
break;
358 case 6:
config->Write(
"lastImageType",
"all files");
break;
422 if (e.GetKeyCode() == 1 && e.CmdDown())
469 wxGetApp().GetToolboxFrame()->HasMonitorProfile(),
wxGetApp().GetToolboxFrame()->GetMonitorProfile());
495 wxGetApp().GetToolboxFrame()->HasMonitorProfile(),
wxGetApp().GetToolboxFrame()->GetMonitorProfile());
508 const int newCol = e.GetColumn();
583 exiftoolArgs.Append(
" -all:all --thumbnail --thumbnailimage --xposition --yposition --imagefullwidth --imagefullheight ");
600 dlg.SetDirectory(path);
604 if (
config->HasEntry(
"lastImageType"))
610 dlg.SetFilterIndex(0);
616 dlg.SetFilterIndex(1);
622 dlg.SetFilterIndex(2);
635 config->Write(
"/actualPath",
dlg.GetDirectory());
637 switch (
dlg.GetFilterIndex())
640 config->Write(
"lastImageType",
"jpg");
643 config->Write(
"lastImageType",
"tiff");
646 config->Write(
"lastImageType",
"png");
657 switch (e.GetSelection())
710 switch (
XRCCTRL(*
this,
"stacker_mode_choice",
wxChoice)->GetSelection())
871#define SORTASCENDING(functionName, var) \
872int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
874 StackerPanel::FileInfoVector* data = (StackerPanel::FileInfoVector*)(sortData);\
875 if (data->at(item1).var > data->at(item2).var)\
877 if (data->at(item1).var < data->at(item2).var)\
882#define SORTDESCENDING(functionName, var) \
883int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
885 StackerPanel::FileInfoVector* data = (StackerPanel::FileInfoVector*)(sortData); \
886 if (data->at(item1).var < data->at(item2).var)\
888 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
EntryPtr getSmallImageIfAvailable(const std::string &filename)
Get a small image if already loaded.
static ImageCache & getInstance()
get the global ImageCache object
RequestPtr requestAsyncSmallImage(const std::string &filename)
Request a small image be loaded.
std::shared_ptr< Entry > EntryPtr
a shared pointer to the entry
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
std::string m_selectedImage
PreviewWindow * m_preview
long GetCheckedItemCount() const
return the number of check images
void OnZoom(wxCommandEvent &e)
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
HuginBase::ImageCache::RequestPtr m_imgRequest
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 AddFileInfo(const long fileIndex)
void OnImageLoaded(HuginBase::ImageCache::EntryPtr entry, std::string filename)
called when is image is fully loaded to display image in wxStaticBitmap
wxStaticBitmap * m_smallImagePreview
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.
void GeneratePreviewSelectedFile(wxStaticBitmap *control, ImageCache::EntryPtr cacheEntry, const bool hasMonitorProfile, const cmsHPROFILE &monitorProfile)
load given image from image cache and display in wxStaticBitmap control