// generated by Fast Light User Interface Designer (fluid) version 1.0300

#include "/home/ddong/COSM_Source_Base/build/tools/gui/toolGUI.h"
#include "toolAbout.h"
#include "xml/toolsXml.h"
#include "FL/Fl_Native_File_Chooser.H"
#include "tinyxml/tinyxml.h"
#include "toolMgr.h"
#include <FL/Fl_Sys_Menu_Bar.H>
#include <FL/fl_ask.H>

void ToolGUI::cb_Quit_i(Fl_Menu_*, void*) {
  exit(0);
}
void ToolGUI::cb_Quit(Fl_Menu_* o, void* v) {
  ((ToolGUI*)(o->parent()->user_data()))->cb_Quit_i(o,v);
}

void ToolGUI::cb_About_i(Fl_Menu_*, void*) {
  if (!aboutDialog) {
    make_about();
}
aboutDialog->show();
}
void ToolGUI::cb_About(Fl_Menu_* o, void* v) {
  ((ToolGUI*)(o->parent()->user_data()))->cb_About_i(o,v);
}

Fl_Menu_Item ToolGUI::menu_[] = {
 {"File", 0,  0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
 {"Quit", 0,  (Fl_Callback*)ToolGUI::cb_Quit, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {0,0,0,0,0,0,0,0,0},
 {"Help", 0,  0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
 {"About...", 0,  (Fl_Callback*)ToolGUI::cb_About, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0}
};

void ToolGUI::cb_Browse_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolInfoDataInput->value(native.filename());
}
void ToolGUI::cb_Browse(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse_i(o,v);
}

void ToolGUI::cb_Open_i(Fl_Button*, void*) {
  executeInfo();
}
void ToolGUI::cb_Open(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Open_i(o,v);
}

void ToolGUI::cb_Browse1_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolRemoveDataInput->value(native.filename());
}
void ToolGUI::cb_Browse1(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse1_i(o,v);
}

void ToolGUI::cb_Browse2_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolRemoveOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse2(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse2_i(o,v);
}

void ToolGUI::cb_Execute_i(Fl_Button*, void*) {
  executeRemove();
}
void ToolGUI::cb_Execute(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute_i(o,v);
}

Fl_Menu_Item ToolGUI::menu_toolAddDataTypeChoice[] = {
 {"BYTE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"SHORT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"FLOAT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"DOUBLE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"USHORT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"INT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"LONGDOUBLE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {0,0,0,0,0,0,0,0,0}
};

void ToolGUI::cb_Browse3_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*");
native.show();
toolAddDataInput->value(native.filename());
}
void ToolGUI::cb_Browse3(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse3_i(o,v);
}

void ToolGUI::cb_Browse4_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolAddOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse4(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse4_i(o,v);
}

void ToolGUI::cb_Execute1_i(Fl_Button*, void*) {
  executeAdd();
}
void ToolGUI::cb_Execute1(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute1_i(o,v);
}

void ToolGUI::cb_toolResampleDown_i(Fl_Round_Button* o, void*) {
  if ( o->value() == true )
{
    toolResampleUp->value(false);
};
}
void ToolGUI::cb_toolResampleDown(Fl_Round_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_toolResampleDown_i(o,v);
}

void ToolGUI::cb_toolResampleUp_i(Fl_Round_Button* o, void*) {
  if ( o->value() == true )
{
    toolResampleDown->value(false);
};
}
void ToolGUI::cb_toolResampleUp(Fl_Round_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_toolResampleUp_i(o,v);
}

void ToolGUI::cb_Browse5_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolResampleDataInput->value(native.filename());
}
void ToolGUI::cb_Browse5(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse5_i(o,v);
}

void ToolGUI::cb_Browse6_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolResampleOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse6(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse6_i(o,v);
}

void ToolGUI::cb_Execute2_i(Fl_Button*, void*) {
  executeResample();
}
void ToolGUI::cb_Execute2(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute2_i(o,v);
}

void ToolGUI::cb_Browse7_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolTransDataInput->value(native.filename());
}
void ToolGUI::cb_Browse7(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse7_i(o,v);
}

void ToolGUI::cb_Browse8_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolTransOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse8(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse8_i(o,v);
}

void ToolGUI::cb_Execute3_i(Fl_Button*, void*) {
  executeTransform();
}
void ToolGUI::cb_Execute3(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute3_i(o,v);
}

void ToolGUI::cb_Browse9_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolShiftDataInput->value(native.filename());
}
void ToolGUI::cb_Browse9(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse9_i(o,v);
}

void ToolGUI::cb_Browsea_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolShiftOutputInput->value(native.filename());
}
void ToolGUI::cb_Browsea(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browsea_i(o,v);
}

void ToolGUI::cb_Execute4_i(Fl_Button*, void*) {
  executeShift();
}
void ToolGUI::cb_Execute4(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute4_i(o,v);
}

void ToolGUI::cb_toolScaleMaxCheck_i(Fl_Check_Button* o, void*) {
  if ( o->value() == true )
{
    toolScaleSumCheck->value(false);
};
}
void ToolGUI::cb_toolScaleMaxCheck(Fl_Check_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_toolScaleMaxCheck_i(o,v);
}

void ToolGUI::cb_Browseb_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolScaleDataInput->value(native.filename());
}
void ToolGUI::cb_Browseb(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browseb_i(o,v);
}

void ToolGUI::cb_Browsec_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolScaleOutputInput->value(native.filename());
}
void ToolGUI::cb_Browsec(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browsec_i(o,v);
}

void ToolGUI::cb_Execute5_i(Fl_Button*, void*) {
  executeScale();
}
void ToolGUI::cb_Execute5(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute5_i(o,v);
}

void ToolGUI::cb_toolScaleSumCheck_i(Fl_Check_Button* o, void*) {
  if ( o->value() == true )
{
    toolScaleMaxCheck->value(false);
};
}
void ToolGUI::cb_toolScaleSumCheck(Fl_Check_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_toolScaleSumCheck_i(o,v);
}

Fl_Menu_Item ToolGUI::menu_toolConvertDataTypeChoice[] = {
 {"BYTE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"SHORT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"FLOAT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"DOUBLE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"USHORT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"INT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"LONGDOUBLE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {0,0,0,0,0,0,0,0,0}
};

void ToolGUI::cb_Browsed_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolConvertDataInput->value(native.filename());
}
void ToolGUI::cb_Browsed(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browsed_i(o,v);
}

void ToolGUI::cb_Browsee_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolConvertOutputInput->value(native.filename());
}
void ToolGUI::cb_Browsee(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browsee_i(o,v);
}

void ToolGUI::cb_Execute6_i(Fl_Button*, void*) {
  executeConvert();
}
void ToolGUI::cb_Execute6(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute6_i(o,v);
}

void ToolGUI::cb_Execute7_i(Fl_Button*, void*) {
  executeCompare();
}
void ToolGUI::cb_Execute7(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Execute7_i(o,v);
}

void ToolGUI::cb_Browsef_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolCompareDataInput->value(native.filename());
}
void ToolGUI::cb_Browsef(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browsef_i(o,v);
}

void ToolGUI::cb_Browse10_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolCompareRefInput->value(native.filename());
}
void ToolGUI::cb_Browse10(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse10_i(o,v);
}

void ToolGUI::cb_Browse11_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolConvImg1Input->value(native.filename());
}
void ToolGUI::cb_Browse11(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse11_i(o,v);
}

void ToolGUI::cb_Browse12_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolConvImg2Input->value(native.filename());
}
void ToolGUI::cb_Browse12(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse12_i(o,v);
}

void ToolGUI::cb_Browse13_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolConvOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse13(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse13_i(o,v);
}

void ToolGUI::cb_Execute8_i(Fl_Button*, void*) {
  executeConvolve();
}
void ToolGUI::cb_Execute8(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Execute8_i(o,v);
}

void ToolGUI::cb_convolveNormalSize_i(Fl_Check_Button*, void*) {
  convolveFirstSize->value(false);
convolveSecondSize->value(false);
}
void ToolGUI::cb_convolveNormalSize(Fl_Check_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_convolveNormalSize_i(o,v);
}

void ToolGUI::cb_convolveFirstSize_i(Fl_Check_Button*, void*) {
  convolveNormalSize->value(false);
convolveSecondSize->value(false);
}
void ToolGUI::cb_convolveFirstSize(Fl_Check_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_convolveFirstSize_i(o,v);
}

void ToolGUI::cb_convolveSecondSize_i(Fl_Check_Button*, void*) {
  convolveFirstSize->value(false);
convolveNormalSize->value(false);
}
void ToolGUI::cb_convolveSecondSize(Fl_Check_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_convolveSecondSize_i(o,v);
}

void ToolGUI::cb_Browse14_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolObjectDataInput->value(native.filename());
}
void ToolGUI::cb_Browse14(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse14_i(o,v);
}

void ToolGUI::cb_Browse15_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolObjectOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse15(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse15_i(o,v);
}

Fl_Menu_Item ToolGUI::menu_toolObjectCreateDataTypeChoice[] = {
 {"BYTE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"SHORT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"FLOAT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"DOUBLE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"USHORT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"INT", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {"LONGDOUBLE", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
 {0,0,0,0,0,0,0,0,0}
};

void ToolGUI::cb_Execute9_i(Fl_Button*, void*) {
  executeObjectCreate();
}
void ToolGUI::cb_Execute9(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Execute9_i(o,v);
}

void ToolGUI::cb_Executea_i(Fl_Button*, void*) {
  executeObjectEllipsoid();
}
void ToolGUI::cb_Executea(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Executea_i(o,v);
}

void ToolGUI::cb_Executeb_i(Fl_Button*, void*) {
  executeObjectBox();
}
void ToolGUI::cb_Executeb(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Executeb_i(o,v);
}

void ToolGUI::cb_Executec_i(Fl_Button*, void*) {
  executeObjectPoint();
}
void ToolGUI::cb_Executec(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Executec_i(o,v);
}

void ToolGUI::cb_Browse16_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolVariantObjectInput->value(native.filename());
}
void ToolGUI::cb_Browse16(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse16_i(o,v);
}

void ToolGUI::cb_Browse17_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolVariantPsfInput->value(native.filename());
}
void ToolGUI::cb_Browse17(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse17_i(o,v);
}

void ToolGUI::cb_Browse18_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolVariantOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse18(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse18_i(o,v);
}

void ToolGUI::cb_Executed_i(Fl_Button*, void*) {
  executeVariant();
}
void ToolGUI::cb_Executed(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Executed_i(o,v);
}

void ToolGUI::cb_toolVariantStrata_i(Fl_Round_Button* o, void*) {
  if ( o->value() == true )
          {
              toolVariantPCA->value(false);
              strataTab->activate();
              PCATab->deactivate();
          };
}
void ToolGUI::cb_toolVariantStrata(Fl_Round_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_toolVariantStrata_i(o,v);
}

void ToolGUI::cb_toolVariantPCA_i(Fl_Round_Button* o, void*) {
  if ( o->value() == true )
          {
              toolVariantStrata->value(false);
              strataTab->deactivate();
              PCATab->activate();
          };
}
void ToolGUI::cb_toolVariantPCA(Fl_Round_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_toolVariantPCA_i(o,v);
}

void ToolGUI::cb_Browse19_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolOriginalPsfInput->value(native.filename());
}
void ToolGUI::cb_Browse19(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse19_i(o,v);
}

void ToolGUI::cb_Browse1a_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolPCAPsfOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse1a(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse1a_i(o,v);
}

void ToolGUI::cb_Executee_i(Fl_Button*, void*) {
  executePCA();
}
void ToolGUI::cb_Executee(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Executee_i(o,v);
}

void ToolGUI::cb_Browse1b_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolCPMPSFInput->value(native.filename());
}
void ToolGUI::cb_Browse1b(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse1b_i(o,v);
}

void ToolGUI::cb_Browse1c_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolCPMMaskInput->value(native.filename());
}
void ToolGUI::cb_Browse1c(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse1c_i(o,v);
}

void ToolGUI::cb_Browse1d_i(Fl_Button*, void*) {
  Fl_Native_File_Chooser native;

native.title("Select Filename to Read");
native.type(Fl_Native_File_Chooser::BROWSE_FILE);
native.filter("*.wu");
native.show();
toolCPMOutputInput->value(native.filename());
}
void ToolGUI::cb_Browse1d(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Browse1d_i(o,v);
}

void ToolGUI::cb_Executef_i(Fl_Button*, void*) {
  executeCPM();
}
void ToolGUI::cb_Executef(Fl_Button* o, void* v) {
  ((ToolGUI*)(o->parent()->parent()->parent()->user_data()))->cb_Executef_i(o,v);
}

ToolGUI::ToolGUI() {
  { toolWindow = new Fl_Double_Window(945, 553, "COSM Tools");
    toolWindow->user_data((void*)(this));
    { Fl_Sys_Menu_Bar* o = new Fl_Sys_Menu_Bar(0, 0, 945, 25);
      o->box(FL_UP_BOX);
      o->color(FL_BACKGROUND_COLOR);
      o->selection_color(FL_SELECTION_COLOR);
      o->labeltype(FL_NORMAL_LABEL);
      o->labelfont(0);
      o->labelsize(14);
      o->labelcolor(FL_FOREGROUND_COLOR);
      o->align(Fl_Align(FL_ALIGN_CENTER));
      o->when(FL_WHEN_RELEASE_ALWAYS);
      Fl_Group::current()->resizable(o);
      o->menu(menu_);
    } // Fl_Sys_Menu_Bar* o
    { Fl_Tabs* o = new Fl_Tabs(20, 50, 905, 485);
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Info");
        o->hide();
        { toolInfoDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolInfoDataInput->tooltip("Path and file name of image to be opened for information");
        } // Fl_File_Input* toolInfoDataInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Open");
          o->tooltip("Open specified file for image information");
          o->callback((Fl_Callback*)cb_Open);
        } // Fl_Button* o
        { Fl_Group* o = new Fl_Group(50, 200, 625, 240, "Image Information:");
          o->box(FL_ENGRAVED_BOX);
          o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
          { toolInfoDataTypeOutput = new Fl_Output(475, 235, 100, 25, "Data Type:");
          } // Fl_Output* toolInfoDataTypeOutput
          { toolInfoZDimOutput = new Fl_Value_Output(350, 236, 30, 24);
          } // Fl_Value_Output* toolInfoZDimOutput
          { toolInfoYDimOutput = new Fl_Value_Output(315, 236, 30, 24);
          } // Fl_Value_Output* toolInfoYDimOutput
          { toolInfoXDimOutput = new Fl_Value_Output(280, 236, 30, 24, "Dimension (x,y,z) :");
          } // Fl_Value_Output* toolInfoXDimOutput
          { toolInfoMaximumOutput = new Fl_Value_Output(280, 311, 100, 24, "Maximum: ");
          } // Fl_Value_Output* toolInfoMaximumOutput
          { toolInfoMinimumOutput = new Fl_Value_Output(280, 346, 100, 24, "Minimum: ");
          } // Fl_Value_Output* toolInfoMinimumOutput
          { toolInfoAverageOutput = new Fl_Value_Output(280, 381, 100, 24, "Average: ");
          } // Fl_Value_Output* toolInfoAverageOutput
          { toolInfoSizeInBytesOutput = new Fl_Value_Output(475, 271, 100, 24, "Size in Bytes: ");
          } // Fl_Value_Output* toolInfoSizeInBytesOutput
          o->end();
        } // Fl_Group* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Remove Header");
        o->hide();
        { toolRemoveDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolRemoveDataInput->tooltip("path and file name for image with header to be removed");
        } // Fl_File_Input* toolRemoveDataInput
        { toolRemoveOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolRemoveOutputInput->tooltip("path and filename for the removed header image");
        } // Fl_File_Input* toolRemoveOutputInput
        { toolRemoveNumberInput = new Fl_Value_Input(320, 340, 100, 25, "Number of File:");
          toolRemoveNumberInput->tooltip("File number to remove header");
          toolRemoveNumberInput->minimum(1);
          toolRemoveNumberInput->maximum(1024);
          toolRemoveNumberInput->value(1);
        } // Fl_Value_Input* toolRemoveNumberInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse1);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse2);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute header removal");
          o->callback((Fl_Callback*)cb_Execute);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Add Header");
        o->hide();
        { toolAddDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolAddDataInput->tooltip("path and filename for input image without a header");
        } // Fl_File_Input* toolAddDataInput
        { toolAddOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolAddOutputInput->tooltip("path and filename for output image with header added");
        } // Fl_File_Input* toolAddOutputInput
        { toolAddXDimInput = new Fl_Value_Input(280, 236, 30, 24, "Dimension (x,y,z) :");
          toolAddXDimInput->tooltip("Size of x dimension in pixels");
          toolAddXDimInput->maximum(0);
        } // Fl_Value_Input* toolAddXDimInput
        { toolAddYDimInput = new Fl_Value_Input(315, 236, 30, 24);
          toolAddYDimInput->tooltip("Size of y dimension in pixels");
          toolAddYDimInput->maximum(0);
        } // Fl_Value_Input* toolAddYDimInput
        { toolAddZDimInput = new Fl_Value_Input(350, 236, 30, 24);
          toolAddZDimInput->tooltip("Size of z dimension in pixels");
          toolAddZDimInput->maximum(0);
        } // Fl_Value_Input* toolAddZDimInput
        { toolAddDataTypeChoice = new Fl_Choice(280, 275, 100, 25, "Output Data Type: ");
          toolAddDataTypeChoice->tooltip("Image pixel data type");
          toolAddDataTypeChoice->down_box(FL_BORDER_BOX);
          toolAddDataTypeChoice->menu(menu_toolAddDataTypeChoice);
          toolAddDataTypeChoice->value(2);
        } // Fl_Choice* toolAddDataTypeChoice
        { toolAddEndianCheck = new Fl_Check_Button(405, 275, 105, 25, "Big Endian");
          toolAddEndianCheck->tooltip("Shift of periodic image if checked");
          toolAddEndianCheck->down_box(FL_DOWN_BOX);
        } // Fl_Check_Button* toolAddEndianCheck
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse3);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse4);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute adding header");
          o->callback((Fl_Callback*)cb_Execute1);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Resample");
        { toolResampleDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolResampleDataInput->tooltip("path and filename for input image without a header");
        } // Fl_File_Input* toolResampleDataInput
        { toolResampleOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolResampleOutputInput->tooltip("path and filename for resampled image");
        } // Fl_File_Input* toolResampleOutputInput
        { toolResampleXDimInput = new Fl_Value_Input(280, 236, 30, 24, "Factor (x,y,z) :");
          toolResampleXDimInput->tooltip("integer resampling factor in x dimensions");
          toolResampleXDimInput->minimum(1);
          toolResampleXDimInput->maximum(100);
          toolResampleXDimInput->value(1);
        } // Fl_Value_Input* toolResampleXDimInput
        { toolResampleYDimInput = new Fl_Value_Input(315, 236, 30, 24);
          toolResampleYDimInput->tooltip("integer resampling factor in y dimension");
          toolResampleYDimInput->minimum(1);
          toolResampleYDimInput->maximum(100);
          toolResampleYDimInput->value(1);
        } // Fl_Value_Input* toolResampleYDimInput
        { toolResampleZDimInput = new Fl_Value_Input(350, 236, 30, 24);
          toolResampleZDimInput->tooltip("Integer resampling factor in z dimension");
          toolResampleZDimInput->minimum(1);
          toolResampleZDimInput->maximum(100);
          toolResampleZDimInput->value(1);
        } // Fl_Value_Input* toolResampleZDimInput
        { Fl_Round_Button* o = toolResampleDown = new Fl_Round_Button(265, 275, 125, 20, "Downsample");
          toolResampleDown->tooltip("Downsample the image");
          toolResampleDown->type(102);
          toolResampleDown->down_box(FL_ROUND_DOWN_BOX);
          toolResampleDown->callback((Fl_Callback*)cb_toolResampleDown);
          o->value(true);
        } // Fl_Round_Button* toolResampleDown
        { toolResampleUp = new Fl_Round_Button(265, 300, 95, 20, "Upsample");
          toolResampleUp->tooltip("upsample the image");
          toolResampleUp->type(102);
          toolResampleUp->down_box(FL_ROUND_DOWN_BOX);
          toolResampleUp->callback((Fl_Callback*)cb_toolResampleUp);
        } // Fl_Round_Button* toolResampleUp
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse5);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse6);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute image resampling");
          o->callback((Fl_Callback*)cb_Execute2);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Transform");
        o->hide();
        { toolTransDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolTransDataInput->tooltip("Path and filename for input image to transform");
        } // Fl_File_Input* toolTransDataInput
        { toolTransOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolTransOutputInput->tooltip("Path and filename for oputput transformed image");
        } // Fl_File_Input* toolTransOutputInput
        { toolTransXShiftInput = new Fl_Value_Input(280, 271, 30, 24, "Shift (x,y,z) :");
          toolTransXShiftInput->tooltip("Shift of x origin in pixels");
        } // Fl_Value_Input* toolTransXShiftInput
        { toolTransYShiftInput = new Fl_Value_Input(315, 271, 30, 24);
          toolTransYShiftInput->tooltip("Shift of y origin in pixels");
        } // Fl_Value_Input* toolTransYShiftInput
        { toolTransZShiftInput = new Fl_Value_Input(350, 271, 30, 24);
          toolTransZShiftInput->tooltip("Shift of z origin in pixels");
        } // Fl_Value_Input* toolTransZShiftInput
        { toolTransFillInput = new Fl_Value_Input(280, 306, 100, 24, "Value Fill:");
          toolTransFillInput->tooltip("value for new pixels not in the orignal image");
        } // Fl_Value_Input* toolTransFillInput
        { toolTransXDimInput = new Fl_Value_Input(280, 236, 30, 24, "Output Dimension (x,y,z) :");
          toolTransXDimInput->tooltip("Size of x output dimension in pixels");
        } // Fl_Value_Input* toolTransXDimInput
        { toolTransYDimInput = new Fl_Value_Input(315, 236, 30, 24);
          toolTransYDimInput->tooltip("Size of y output dimension in pixels");
        } // Fl_Value_Input* toolTransYDimInput
        { toolTransZDimInput = new Fl_Value_Input(350, 236, 30, 24);
          toolTransZDimInput->tooltip("Size of z output dimension in pixels");
        } // Fl_Value_Input* toolTransZDimInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse7);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse8);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute image transform");
          o->callback((Fl_Callback*)cb_Execute3);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Shift");
        o->hide();
        { toolShiftDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolShiftDataInput->tooltip("Path and filename for input image to be shifted");
        } // Fl_File_Input* toolShiftDataInput
        { toolShiftOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolShiftOutputInput->tooltip("path and filename for shifted output image");
        } // Fl_File_Input* toolShiftOutputInput
        { toolShiftXShiftInput = new Fl_Value_Input(280, 271, 30, 24, "Shift (x,y,z) :");
          toolShiftXShiftInput->tooltip("Shift of x origin in pixels");
        } // Fl_Value_Input* toolShiftXShiftInput
        { toolShiftYShiftInput = new Fl_Value_Input(315, 271, 30, 24);
          toolShiftYShiftInput->tooltip("Shift of y origin in pixels");
        } // Fl_Value_Input* toolShiftYShiftInput
        { toolShiftZShiftInput = new Fl_Value_Input(350, 271, 30, 24);
          toolShiftZShiftInput->tooltip("Shift of z origin in pixels");
        } // Fl_Value_Input* toolShiftZShiftInput
        { toolShiftCircularCheck = new Fl_Check_Button(405, 270, 105, 25, "Circular");
          toolShiftCircularCheck->tooltip("Shift of periodic image if checked");
          toolShiftCircularCheck->down_box(FL_DOWN_BOX);
        } // Fl_Check_Button* toolShiftCircularCheck
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse9);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browsea);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute image shift");
          o->callback((Fl_Callback*)cb_Execute4);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 455, "Scale");
        o->hide();
        { toolScaleDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolScaleDataInput->tooltip("Path and filename for input image to be scaled");
        } // Fl_File_Input* toolScaleDataInput
        { toolScaleOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolScaleOutputInput->tooltip("path and filename for scaled output image");
        } // Fl_File_Input* toolScaleOutputInput
        { toolScaleMaxCheck = new Fl_Check_Button(405, 270, 125, 25, "Scale with Max");
          toolScaleMaxCheck->tooltip("Shift of periodic image if checked");
          toolScaleMaxCheck->down_box(FL_DOWN_BOX);
          toolScaleMaxCheck->callback((Fl_Callback*)cb_toolScaleMaxCheck);
        } // Fl_Check_Button* toolScaleMaxCheck
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browseb);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browsec);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute image shift");
          o->callback((Fl_Callback*)cb_Execute5);
        } // Fl_Button* o
        { toolScaleValueInput = new Fl_Value_Input(280, 306, 130, 24, "Scale with Value");
          toolScaleValueInput->tooltip("value for new pixels not in the orignal image");
          toolScaleValueInput->align(Fl_Align(FL_ALIGN_RIGHT));
        } // Fl_Value_Input* toolScaleValueInput
        { toolScaleSumCheck = new Fl_Check_Button(280, 270, 125, 25, "Scale with Sum");
          toolScaleSumCheck->tooltip("Shift of periodic image if checked");
          toolScaleSumCheck->down_box(FL_DOWN_BOX);
          toolScaleSumCheck->callback((Fl_Callback*)cb_toolScaleSumCheck);
        } // Fl_Check_Button* toolScaleSumCheck
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 455, "Convert");
        o->hide();
        { toolConvertDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolConvertDataInput->tooltip("path and filename for image to be converted");
        } // Fl_File_Input* toolConvertDataInput
        { toolConvertOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolConvertOutputInput->tooltip("path and filename for converted output image");
        } // Fl_File_Input* toolConvertOutputInput
        { toolConvertNumberInput = new Fl_Value_Input(320, 340, 100, 25, "Number of File:");
          toolConvertNumberInput->tooltip("File number to convert");
          toolConvertNumberInput->minimum(1);
          toolConvertNumberInput->maximum(1024);
          toolConvertNumberInput->value(1);
        } // Fl_Value_Input* toolConvertNumberInput
        { toolConvertDataTypeChoice = new Fl_Choice(320, 300, 100, 25, "Output Data Type: ");
          toolConvertDataTypeChoice->tooltip("Data type for pixel values");
          toolConvertDataTypeChoice->down_box(FL_BORDER_BOX);
          toolConvertDataTypeChoice->menu(menu_toolConvertDataTypeChoice);
          toolConvertDataTypeChoice->value(2);
        } // Fl_Choice* toolConvertDataTypeChoice
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browsed);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browsee);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute image conversion");
          o->callback((Fl_Callback*)cb_Execute6);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 455, "Compare");
        o->hide();
        { toolCompareDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolCompareDataInput->tooltip("Path and filename for input image to be compared");
        } // Fl_File_Input* toolCompareDataInput
        { toolCompareRefInput = new Fl_File_Input(165, 140, 390, 30, "Reference File:");
          toolCompareRefInput->tooltip("path and filename for reference image to compare to");
        } // Fl_File_Input* toolCompareRefInput
        { Fl_Group* o = new Fl_Group(50, 200, 625, 240, "Error Measure:");
          o->box(FL_ENGRAVED_BOX);
          o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
          { toolCompareMaximumOutput = new Fl_Value_Output(280, 311, 100, 24, "Maximum: ");
          } // Fl_Value_Output* toolCompareMaximumOutput
          { toolCompareMeanOutput = new Fl_Value_Output(280, 346, 100, 24, "Mean: ");
          } // Fl_Value_Output* toolCompareMeanOutput
          { toolCompareMeanSquareOutput = new Fl_Value_Output(280, 381, 100, 24, "Mean Square: ");
          } // Fl_Value_Output* toolCompareMeanSquareOutput
          { Fl_Button* o = new Fl_Button(280, 250, 100, 25, "Execute");
            o->tooltip("Execute image comparision");
            o->callback((Fl_Callback*)cb_Execute7);
          } // Fl_Button* o
          o->end();
        } // Fl_Group* o
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browsef);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse10);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Convolve");
        o->hide();
        { toolConvImg1Input = new Fl_File_Input(165, 100, 390, 30, "1st Image File:");
          toolConvImg1Input->tooltip("path and filename for input image to convolve");
        } // Fl_File_Input* toolConvImg1Input
        { toolConvImg2Input = new Fl_File_Input(165, 140, 390, 30, "2nd Image File:");
          toolConvImg2Input->tooltip("path and filename for input image to convolve");
        } // Fl_File_Input* toolConvImg2Input
        { Fl_Check_Button* o = toolConvolveCenteredPsfCheck = new Fl_Check_Button(540, 170, 20, 15, " Centered PSF");
          toolConvolveCenteredPsfCheck->down_box(FL_DOWN_BOX);
          toolConvolveCenteredPsfCheck->labelsize(12);
          toolConvolveCenteredPsfCheck->align(Fl_Align(FL_ALIGN_LEFT));
          o->value(true);
        } // Fl_Check_Button* toolConvolveCenteredPsfCheck
        { toolConvOutputInput = new Fl_File_Input(165, 195, 390, 30, "Output File:");
          toolConvOutputInput->tooltip("path and filename for convolved output image");
        } // Fl_File_Input* toolConvOutputInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse11);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse12);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse13);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 225, 90, 25, "Execute");
          o->tooltip("Execute  convolution of two images");
          o->callback((Fl_Callback*)cb_Execute8);
        } // Fl_Button* o
        { Fl_Box* o = new Fl_Box(225, 249, 205, 98, "Output Image Size:");
          o->box(FL_ENGRAVED_BOX);
          o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
        } // Fl_Box* o
        { Fl_Check_Button* o = convolveNormalSize = new Fl_Check_Button(250, 270, 64, 15, "Normal Size");
          convolveNormalSize->down_box(FL_DOWN_BOX);
          convolveNormalSize->callback((Fl_Callback*)cb_convolveNormalSize);
          o->value(true);
        } // Fl_Check_Button* convolveNormalSize
        { convolveFirstSize = new Fl_Check_Button(250, 290, 64, 15, "Size of 1st Image");
          convolveFirstSize->down_box(FL_DOWN_BOX);
          convolveFirstSize->callback((Fl_Callback*)cb_convolveFirstSize);
        } // Fl_Check_Button* convolveFirstSize
        { convolveSecondSize = new Fl_Check_Button(250, 310, 64, 15, "Size of 2nd Image");
          convolveSecondSize->down_box(FL_DOWN_BOX);
          convolveSecondSize->callback((Fl_Callback*)cb_convolveSecondSize);
        } // Fl_Check_Button* convolveSecondSize
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 735, 450, "Object");
        o->hide();
        { toolObjectDataInput = new Fl_File_Input(165, 100, 390, 30, "Image File:");
          toolObjectDataInput->tooltip("path and filename of input image to add object to");
        } // Fl_File_Input* toolObjectDataInput
        { toolObjectOutputInput = new Fl_File_Input(165, 140, 390, 30, "Output File:");
          toolObjectOutputInput->tooltip("Path and filename for output image with new object");
        } // Fl_File_Input* toolObjectOutputInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse14);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse15);
        } // Fl_Button* o
        { Fl_Tabs* o = new Fl_Tabs(55, 235, 620, 265);
          { Fl_Group* o = new Fl_Group(60, 260, 610, 235, "Create");
            o->hide();
            { toolObjectCreateXDimInput = new Fl_Value_Input(335, 321, 30, 24, "Dimensions(x,y,z) :");
              toolObjectCreateXDimInput->tooltip("Size of x dimension in pixels of output image");
            } // Fl_Value_Input* toolObjectCreateXDimInput
            { toolObjectCreateYDimInput = new Fl_Value_Input(370, 321, 30, 24);
              toolObjectCreateYDimInput->tooltip("Size of y dimension in pixels of output image");
            } // Fl_Value_Input* toolObjectCreateYDimInput
            { toolObjectCreateZDimInput = new Fl_Value_Input(405, 321, 30, 24);
              toolObjectCreateZDimInput->tooltip("Size of z dimension in pixels of output image");
            } // Fl_Value_Input* toolObjectCreateZDimInput
            { toolObjectCreateValueInput = new Fl_Value_Input(335, 391, 100, 24, "Value :");
              toolObjectCreateValueInput->tooltip("Pixel values to use");
            } // Fl_Value_Input* toolObjectCreateValueInput
            { toolObjectCreateDataTypeChoice = new Fl_Choice(335, 355, 100, 25, "Data Type: ");
              toolObjectCreateDataTypeChoice->tooltip("Data type of pixel values");
              toolObjectCreateDataTypeChoice->down_box(FL_BORDER_BOX);
              toolObjectCreateDataTypeChoice->menu(menu_toolObjectCreateDataTypeChoice);
            } // Fl_Choice* toolObjectCreateDataTypeChoice
            { Fl_Button* o = new Fl_Button(335, 425, 100, 25, "Execute");
              o->tooltip("Execute object creation");
              o->callback((Fl_Callback*)cb_Execute9);
            } // Fl_Button* o
            o->end();
          } // Fl_Group* o
          { Fl_Group* o = new Fl_Group(55, 260, 620, 235, "Ellipsoid");
            o->hide();
            { toolObjectEllipsoidCenterXInput = new Fl_Value_Input(335, 321, 30, 24, "Center(x,y,z) :");
              toolObjectEllipsoidCenterXInput->tooltip("Center of ellipsoid in x dimension in pixels");
            } // Fl_Value_Input* toolObjectEllipsoidCenterXInput
            { toolObjectEllipsoidCenterYInput = new Fl_Value_Input(370, 321, 30, 24);
              toolObjectEllipsoidCenterYInput->tooltip("Center of ellipsoid in y dimension in pixels");
            } // Fl_Value_Input* toolObjectEllipsoidCenterYInput
            { toolObjectEllipsoidCenterZInput = new Fl_Value_Input(405, 321, 30, 24);
              toolObjectEllipsoidCenterZInput->tooltip("Center of ellipsoid in z dimension in pixels");
            } // Fl_Value_Input* toolObjectEllipsoidCenterZInput
            { toolObjectEllipsoidRadiusXInput = new Fl_Value_Input(335, 356, 30, 24, "Radius (x,y,z) :");
              toolObjectEllipsoidRadiusXInput->tooltip("Radius of ellipsoid in x dimension in pixels");
            } // Fl_Value_Input* toolObjectEllipsoidRadiusXInput
            { toolObjectEllipsoidRadiusYInput = new Fl_Value_Input(370, 356, 30, 24);
              toolObjectEllipsoidRadiusYInput->tooltip("Radius of ellipsoid in y dimension in pixels");
            } // Fl_Value_Input* toolObjectEllipsoidRadiusYInput
            { toolObjectEllipsoidRadiusZInput = new Fl_Value_Input(405, 356, 30, 24);
              toolObjectEllipsoidRadiusZInput->tooltip("Radius of ellipsoid in z dimension in pixels");
            } // Fl_Value_Input* toolObjectEllipsoidRadiusZInput
            { toolObjectEllipsoidValueInput = new Fl_Value_Input(335, 391, 100, 24, "Value :");
              toolObjectEllipsoidValueInput->tooltip("Pixel values of ellipsoid");
            } // Fl_Value_Input* toolObjectEllipsoidValueInput
            { Fl_Button* o = new Fl_Button(335, 425, 100, 25, "Execute");
              o->tooltip("Execute ellipsoid image insertion");
              o->callback((Fl_Callback*)cb_Executea);
            } // Fl_Button* o
            o->end();
          } // Fl_Group* o
          { Fl_Group* o = new Fl_Group(55, 260, 620, 235, "Box");
            { toolObjectBoxCenterXInput = new Fl_Value_Input(335, 321, 30, 24, "Center(x,y,z) :");
              toolObjectBoxCenterXInput->tooltip("Center of box in x dimension in pixels");
            } // Fl_Value_Input* toolObjectBoxCenterXInput
            { toolObjectBoxCenterYInput = new Fl_Value_Input(370, 321, 30, 24);
              toolObjectBoxCenterYInput->tooltip("Center of box in y dimension in pixels");
            } // Fl_Value_Input* toolObjectBoxCenterYInput
            { toolObjectBoxCenterZInput = new Fl_Value_Input(405, 321, 30, 24);
              toolObjectBoxCenterZInput->tooltip("Center of box in z dimension in pixels");
            } // Fl_Value_Input* toolObjectBoxCenterZInput
            { toolObjectBoxSizeXInput = new Fl_Value_Input(335, 356, 30, 24, "Half Size(x,y,z) :");
              toolObjectBoxSizeXInput->tooltip("Half of the box size in x dimension in pixels");
            } // Fl_Value_Input* toolObjectBoxSizeXInput
            { toolObjectBoxSizeYInput = new Fl_Value_Input(370, 356, 30, 24);
              toolObjectBoxSizeYInput->tooltip("Half of the box size in y dimension in pxels");
            } // Fl_Value_Input* toolObjectBoxSizeYInput
            { toolObjectBoxSizeZInput = new Fl_Value_Input(405, 356, 30, 24);
              toolObjectBoxSizeZInput->tooltip("Half of the box size in z dimension in pixels");
            } // Fl_Value_Input* toolObjectBoxSizeZInput
            { toolObjectBoxValueInput = new Fl_Value_Input(335, 391, 100, 24, "Value :");
              toolObjectBoxValueInput->tooltip("Pixel values for the box");
            } // Fl_Value_Input* toolObjectBoxValueInput
            { Fl_Button* o = new Fl_Button(335, 425, 100, 25, "Execute");
              o->tooltip("Execute box image insertion");
              o->callback((Fl_Callback*)cb_Executeb);
            } // Fl_Button* o
            o->end();
          } // Fl_Group* o
          { Fl_Group* o = new Fl_Group(55, 260, 620, 240, "Point");
            o->hide();
            { toolObjectPointXInput = new Fl_Value_Input(345, 331, 30, 24, "Position(x,y,z) :");
              toolObjectPointXInput->tooltip("Center of box in x dimension in pixels");
              toolObjectPointXInput->step(1);
            } // Fl_Value_Input* toolObjectPointXInput
            { toolObjectPointYInput = new Fl_Value_Input(380, 331, 30, 24);
              toolObjectPointYInput->tooltip("Center of box in y dimension in pixels");
              toolObjectPointYInput->step(1);
            } // Fl_Value_Input* toolObjectPointYInput
            { toolObjectPointZInput = new Fl_Value_Input(415, 331, 30, 24);
              toolObjectPointZInput->tooltip("Center of box in z dimension in pixels");
              toolObjectPointZInput->step(1);
            } // Fl_Value_Input* toolObjectPointZInput
            { toolObjectPointValueInput = new Fl_Value_Input(345, 401, 100, 24, "Value :");
              toolObjectPointValueInput->tooltip("Pixel values for the box");
            } // Fl_Value_Input* toolObjectPointValueInput
            { Fl_Button* o = new Fl_Button(345, 435, 100, 25, "Execute");
              o->tooltip("Execute box image insertion");
              o->callback((Fl_Callback*)cb_Executec);
            } // Fl_Button* o
            o->end();
          } // Fl_Group* o
          o->end();
        } // Fl_Tabs* o
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(20, 75, 785, 450, "Variant");
        o->hide();
        { toolVariantObjectInput = new Fl_File_Input(165, 100, 390, 30, "Object File:");
          toolVariantObjectInput->tooltip("path and filename for input image to vary");
        } // Fl_File_Input* toolVariantObjectInput
        { toolVariantPsfInput = new Fl_File_Input(165, 140, 390, 30, "PSF File:");
          toolVariantPsfInput->tooltip("path and filename for input image to reference");
        } // Fl_File_Input* toolVariantPsfInput
        { Fl_Check_Button* o = toolVariantCenteredPsfCheck = new Fl_Check_Button(540, 170, 20, 15, " Centered PSF");
          toolVariantCenteredPsfCheck->down_box(FL_DOWN_BOX);
          toolVariantCenteredPsfCheck->labelsize(12);
          toolVariantCenteredPsfCheck->align(Fl_Align(FL_ALIGN_LEFT));
          o->value(true);
        } // Fl_Check_Button* toolVariantCenteredPsfCheck
        { toolVariantOutputInput = new Fl_File_Input(165, 195, 390, 30, "Output File:");
          toolVariantOutputInput->tooltip("path and filename for variant output image");
        } // Fl_File_Input* toolVariantOutputInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse16);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse17);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse18);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 225, 90, 25, "Execute");
          o->tooltip("Execute variation of two images");
          o->callback((Fl_Callback*)cb_Executed);
        } // Fl_Button* o
        { Fl_Round_Button* o = toolVariantStrata = new Fl_Round_Button(265, 245, 125, 20, "Strata mode");
          toolVariantStrata->tooltip("Use strata model to do variant forward");
          toolVariantStrata->type(102);
          toolVariantStrata->down_box(FL_ROUND_DOWN_BOX);
          toolVariantStrata->callback((Fl_Callback*)cb_toolVariantStrata);
          o->value(true);
        } // Fl_Round_Button* toolVariantStrata
        { toolVariantPCA = new Fl_Round_Button(265, 270, 95, 20, "PCA mode");
          toolVariantPCA->tooltip("Use PCA model to do variant forward");
          toolVariantPCA->type(102);
          toolVariantPCA->down_box(FL_ROUND_DOWN_BOX);
          toolVariantPCA->callback((Fl_Callback*)cb_toolVariantPCA);
        } // Fl_Round_Button* toolVariantPCA
        { strataTab = new Fl_Group(50, 320, 290, 130, "Strata");
          strataTab->box(FL_ENGRAVED_BOX);
          strataTab->align(Fl_Align(FL_ALIGN_TOP_LEFT));
          { toolVariantNumberInput = new Fl_Value_Input(195, 335, 100, 24, "Number of Strata:");
            toolVariantNumberInput->tooltip("Value of number of strata");
          } // Fl_Value_Input* toolVariantNumberInput
          { toolVariantStartInput = new Fl_Value_Input(195, 370, 100, 24, "Start of Strata:");
            toolVariantStartInput->tooltip("Starting position of strata");
          } // Fl_Value_Input* toolVariantStartInput
          { toolVariantSizeInput = new Fl_Value_Input(195, 405, 100, 24, "Size of Strata:");
            toolVariantSizeInput->tooltip("Size of each strata covered");
          } // Fl_Value_Input* toolVariantSizeInput
          strataTab->end();
        } // Fl_Group* strataTab
        { PCATab = new Fl_Group(360, 320, 335, 130, "PCA");
          PCATab->box(FL_ENGRAVED_BOX);
          PCATab->align(Fl_Align(FL_ALIGN_TOP_LEFT));
          PCATab->deactivate();
          { toolVariantComponentsNumberInput = new Fl_Value_Input(545, 335, 100, 24, "Number of Component:");
            toolVariantComponentsNumberInput->tooltip("Number of components used in PCA model");
          } // Fl_Value_Input* toolVariantComponentsNumberInput
          { toolVariantPSFStartInput = new Fl_Value_Input(545, 370, 100, 24, "Start of PSF File:");
            toolVariantPSFStartInput->tooltip("Starting position of PSF files");
          } // Fl_Value_Input* toolVariantPSFStartInput
          { toolVariantPSFNumberInput = new Fl_Value_Input(545, 405, 100, 24, "Number of PSF File:");
            toolVariantPSFNumberInput->tooltip("Number of PSF files used in PCA model");
          } // Fl_Value_Input* toolVariantPSFNumberInput
          PCATab->end();
        } // Fl_Group* PCATab
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(45, 75, 805, 460, "PCA");
        o->hide();
        { toolOriginalPsfInput = new Fl_File_Input(165, 100, 390, 30, "Original PSF File:");
          toolOriginalPsfInput->tooltip("path and filename for input original psf");
        } // Fl_File_Input* toolOriginalPsfInput
        { toolPCAPsfOutputInput = new Fl_File_Input(165, 140, 390, 30, "PCA-Based PSF File:");
          toolPCAPsfOutputInput->tooltip("path and filename for PCA-based output psf");
        } // Fl_File_Input* toolPCAPsfOutputInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse19);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse1a);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Execute");
          o->tooltip("Execute PCA-based Psf(s)");
          o->callback((Fl_Callback*)cb_Executee);
        } // Fl_Button* o
        { toolNumberPsfInput = new Fl_Value_Input(280, 236, 100, 24, "Number of PSF Files:");
          toolNumberPsfInput->tooltip("number of psf(s) which will be represented on PCA-based");
        } // Fl_Value_Input* toolNumberPsfInput
        { toolDepthIntervalInput = new Fl_Value_Input(280, 271, 100, 24, "Depth interval between PSFs [pixels]:");
          toolDepthIntervalInput->tooltip("Depth interval between PSFs[pixels]");
          toolDepthIntervalInput->value(1);
        } // Fl_Value_Input* toolDepthIntervalInput
        { toolNumberComponent1Input = new Fl_Value_Input(280, 306, 100, 24, "Number of Components:");
          toolNumberComponent1Input->tooltip("number of principle component which is used in PCA algorithm");
        } // Fl_Value_Input* toolNumberComponent1Input
        o->end();
      } // Fl_Group* o
      { Fl_Group* o = new Fl_Group(45, 75, 880, 450, "WFE-PSF");
        o->hide();
        { toolCPMPSFInput = new Fl_File_Input(165, 100, 390, 30, "Conventional PSF:");
          toolCPMPSFInput->tooltip("path and filename for input PSF files (real and imaginary parts)");
        } // Fl_File_Input* toolCPMPSFInput
        { toolCPMMaskInput = new Fl_File_Input(165, 140, 390, 30, "Mask File:");
          toolCPMMaskInput->tooltip("path and filename for input mask files");
        } // Fl_File_Input* toolCPMMaskInput
        { Fl_Check_Button* o = toolCPMCenteredPsfCheck = new Fl_Check_Button(540, 170, 20, 15, " Centered PSF");
          toolCPMCenteredPsfCheck->down_box(FL_DOWN_BOX);
          toolCPMCenteredPsfCheck->labelsize(12);
          toolCPMCenteredPsfCheck->align(Fl_Align(FL_ALIGN_LEFT));
          o->value(true);
        } // Fl_Check_Button* toolCPMCenteredPsfCheck
        { toolCPMOutputInput = new Fl_File_Input(165, 195, 390, 30, "Output File:");
          toolCPMOutputInput->tooltip("path and filename for output image");
        } // Fl_File_Input* toolCPMOutputInput
        { Fl_Button* o = new Fl_Button(585, 105, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse1b);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 145, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse1c);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 185, 90, 25, "Browse...");
          o->callback((Fl_Callback*)cb_Browse1d);
        } // Fl_Button* o
        { Fl_Button* o = new Fl_Button(585, 225, 90, 25, "Execute");
          o->tooltip("Execute CPM-based PSF engieering process");
          o->callback((Fl_Callback*)cb_Executef);
        } // Fl_Button* o
        o->end();
      } // Fl_Group* o
      o->end();
    } // Fl_Tabs* o
    toolWindow->end();
  } // Fl_Double_Window* toolWindow
}

ToolGUI::~ToolGUI() {
}

void ToolGUI::show(int argc, char* argv[]) {
  this->toolWindow->show(argc, argv);
}

void ToolGUI::executeInfo() {
  cosm::ToolMgr toolMgr(toolInfoDataInput->value());
  cosm::wuHeader header;
  bool res = toolMgr.info(header);
  if ( res ) 
  {
      toolInfoXDimOutput->value(header.columns());
      toolInfoYDimOutput->value(header.rows());
      toolInfoZDimOutput->value(header.sections());
  
      toolInfoMaximumOutput->value(header.maximum());
      toolInfoMinimumOutput->value(header.minimum());
      toolInfoAverageOutput->value(header.mean());
      toolInfoDataTypeOutput->value(header.dataTypeStr().c_str());
      toolInfoSizeInBytesOutput->value(header.dataSize());
  }
  else
  {
      fl_alert("Unknown image filename");
  }
}

void ToolGUI::executeRemove() {
  cosm::ToolMgr toolMgr(toolRemoveDataInput->value(), toolRemoveOutputInput->value());
      
  int numberOfFile = toolRemoveNumberInput->value();
  bool res = toolMgr.removeHeader(numberOfFile);
  
  if ( !res )
  {
      fl_alert("Unknown image filenames");
  }
}

void ToolGUI::executeAdd() {
  cosm::ToolMgr toolMgr(toolAddDataInput->value(),toolAddOutputInput->value());
  
  int x = (int)toolAddXDimInput->value();
  int y = (int)toolAddYDimInput->value();
  int z = (int)toolAddZDimInput->value();
  cosm::wuHeader::type type = (cosm::wuHeader::type)toolAddDataTypeChoice->value();
  bool endian = (bool)toolAddEndianCheck->value();
  bool res = toolMgr.addHeader(x,y,z,type,endian);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeResample() {
  cosm::ToolMgr toolMgr(toolResampleDataInput->value(),toolResampleOutputInput->value());
  
  int x = (int) toolResampleXDimInput->value();
  int y = (int) toolResampleYDimInput->value();
  int z = (int) toolResampleZDimInput->value();
  
  bool up = toolResampleUp->value();
  bool res = toolMgr.resample(x,y,z, up);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeTransform() {
  cosm::ToolMgr toolMgr(toolTransDataInput->value(), toolTransOutputInput->value());
  
  int x = (int)toolTransXDimInput->value();
  int y = (int)toolTransYDimInput->value();
  int z = (int)toolTransZDimInput->value();
  
  int xShift = (int)toolTransXShiftInput->value();
  int yShift = (int)toolTransYShiftInput->value();
  int zShift = (int)toolTransZShiftInput->value();
  
  double value = toolTransFillInput->value();
  
  bool res = toolMgr.transformation(x,y,z, xShift, yShift, zShift, value);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeConvert() {
  cosm::ToolMgr toolMgr(toolConvertDataInput->value(), toolConvertOutputInput->value());
  
  cosm::wuHeader::type type = (cosm::wuHeader::type)toolConvertDataTypeChoice->value();
  int numberOfFile = toolConvertNumberInput->value();
  
  bool res = toolMgr.convert(type, numberOfFile);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeCompare() {
  cosm::ToolMgr toolMgr(toolCompareDataInput->value(),toolCompareRefInput->value(),"");
  double maximum, mean, meanSquare;
  bool res = toolMgr.compare(maximum, mean, meanSquare);
  if ( res ) 
  {
      toolCompareMaximumOutput->value(maximum);
      toolCompareMeanOutput->value(mean);
      toolCompareMeanSquareOutput->value(meanSquare);
  }
  else
  {
      fl_alert("Unknown filenames");
  }
}

void ToolGUI::executeConvolve() {
  cosm::ToolMgr toolMgr(toolConvImg1Input->value(), toolConvImg2Input->value(), toolConvOutputInput->value());
  unsigned short size = convolveNormalSize->value() ? 0 : ( convolveFirstSize->value() ? 1 : 2);
      bool centeredPsf = toolConvolveCenteredPsfCheck->value();
      bool res = toolMgr.convolve(size, centeredPsf);
  if (!res)
  {
      fl_alert("Unknown filenames");
  }
  	std::string otfname = toolConvOutputInput->value();
  	std::string toolsprefix;
  	
  	size_t i = otfname.rfind('.', otfname.length( ));
  	if (i != std::string::npos) {
  	    toolsprefix = otfname.substr(0,i);
  	}
  	
  	std::string xmlname = toolsprefix + ".xml";
  	std::cout << "Xml file: "<<xmlname<< std::endl;
  	writeXmlConvolve(xmlname);
}

void ToolGUI::executeShift() {
  cosm::ToolMgr toolMgr(toolShiftDataInput->value(), toolShiftOutputInput->value());
  
  int xShift = (int)toolShiftXShiftInput->value();
  int yShift = (int)toolShiftYShiftInput->value();
  int zShift = (int)toolShiftZShiftInput->value();
  
  bool circular = toolShiftCircularCheck->value();
  
  bool res = toolMgr.shift(xShift,yShift,zShift,circular);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeScale() {
  cosm::ToolMgr toolMgr(toolScaleDataInput->value(), toolScaleOutputInput->value());
  
  double value = toolScaleValueInput->value();
  bool sum = toolScaleSumCheck->value();
  bool max = toolScaleMaxCheck->value();
  
  bool res = toolMgr.scale(sum,max,value);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeObjectCreate() {
  cosm::ToolMgr toolMgr("", toolObjectOutputInput->value());
  
  int x = (int)toolObjectCreateXDimInput->value();
  int y = (int)toolObjectCreateYDimInput->value();
  int z = (int)toolObjectCreateZDimInput->value();
  cosm::wuHeader::type type = (cosm::wuHeader::type)toolObjectCreateDataTypeChoice->value();
  double value = toolObjectCreateValueInput->value();
  bool res = toolMgr.create(x,y,z,type,value);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeObjectEllipsoid() {
  cosm::ToolMgr toolMgr(toolObjectDataInput->value(), toolObjectOutputInput->value());
  
  int x = (int)toolObjectEllipsoidCenterXInput->value();
  int y = (int)toolObjectEllipsoidCenterYInput->value();
  int z = (int)toolObjectEllipsoidCenterZInput->value();
  int xRadius = (int)toolObjectEllipsoidRadiusXInput->value();
  int yRadius = (int)toolObjectEllipsoidRadiusYInput->value();
  int zRadius = (int)toolObjectEllipsoidRadiusZInput->value();
  
  double value = toolObjectEllipsoidValueInput->value();
  
  bool res = toolMgr.ellipsoid(x,y,z,xRadius,yRadius,zRadius,value);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeObjectBox() {
  cosm::ToolMgr toolMgr(toolObjectDataInput->value(), toolObjectOutputInput->value());
  
  int x = (int)toolObjectBoxCenterXInput->value();
  int y = (int)toolObjectBoxCenterYInput->value();
  int z = (int)toolObjectBoxCenterZInput->value();
  int xSize = (int)toolObjectBoxSizeXInput->value();
  int ySize = (int)toolObjectBoxSizeYInput->value();
  int zSize = (int)toolObjectBoxSizeZInput->value();
  
  double value = toolObjectBoxValueInput->value();
  
  bool res = toolMgr.box(x,y,z,xSize,ySize,zSize,value);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeObjectPoint() {
  cosm::ToolMgr toolMgr(toolObjectDataInput->value(), toolObjectOutputInput->value());
  
  int x = (int)toolObjectPointXInput->value();
  int y = (int)toolObjectPointYInput->value();
  int z = (int)toolObjectPointZInput->value();
  
  double value = toolObjectPointValueInput->value();
  
  bool res = toolMgr.point(x,y,z, value);
  if (!res)
  {
      fl_alert("Unknown filenames or parameters");
  }
}

void ToolGUI::executeVariant() {
  cosm::ToolMgr toolMgr(toolVariantObjectInput->value(), toolVariantPsfInput->value(), toolVariantOutputInput->value());
      bool centeredPsf = toolVariantCenteredPsfCheck->value();
      
      bool strataModel = toolVariantStrata->value();
      bool PCAModel = toolVariantPCA->value();
      int numberOfStrata;
  	int startOfStrata;
  	int sizeOfStrata;
      
      if (strataModel == true)
      {
  		numberOfStrata = toolVariantNumberInput->value();
  		startOfStrata = toolVariantStartInput->value();
  		sizeOfStrata = toolVariantSizeInput->value();
  	}else if (PCAModel == true)
  	{
  		numberOfStrata = toolVariantComponentsNumberInput->value();
  		startOfStrata = toolVariantPSFStartInput->value();
  		sizeOfStrata = toolVariantPSFNumberInput->value();
  	} else {
  		fl_alert("Unknown model");
  	}
  
  bool res = toolMgr.variant(numberOfStrata, startOfStrata, sizeOfStrata, centeredPsf, strataModel);
  if (!res)
  {
      fl_alert("Unknown filenames or unsuitable parameters!");
  }
  
  	std::string otfname = toolVariantOutputInput->value();
  	std::string toolsprefix;
  	
  	size_t i = otfname.rfind('.', otfname.length( ));
  	if (i != std::string::npos) {
  	    toolsprefix = otfname.substr(0,i);
  	}
  	
  	std::string xmlname = toolsprefix + ".xml";
  	std::cout << "Xml file: "<<xmlname<< std::endl;
  	writeXmlVariant(xmlname);
}

void ToolGUI::executePCA() {
  cosm::ToolMgr toolMgr(toolOriginalPsfInput->value(), toolPCAPsfOutputInput->value());
      
  	int numberOfPsf = toolNumberPsfInput->value();
  	int depthOfInterval = toolDepthIntervalInput->value();
  	int numberOfComponent = toolNumberComponent1Input->value();
  	
  	bool res = toolMgr.pca(numberOfPsf, depthOfInterval, numberOfComponent);
  	if (!res)
  	{
  		fl_alert("Unknown filenames");
  	}
}

void ToolGUI::executeCPM() {
  cosm::ToolMgr toolMgr(toolCPMPSFInput->value(), toolCPMMaskInput->value(), toolCPMOutputInput->value());
      bool centeredPsf = toolCPMCenteredPsfCheck->value();
      bool res = toolMgr.cpm(centeredPsf);
  	if (!res)
  	{
  		fl_alert("Unknown filenames");
  	}
}

void ToolGUI::writeXmlConvolve( const std::string& filename ) {
  cosm::ToolsXml<double> toolsXml;
      
      toolsXml.convolveCenteredPSF(toolConvolveCenteredPsfCheck->value());
      
  	toolsXml.imgFile(toolConvImg1Input->value());
  	toolsXml.psfFile(toolConvImg2Input->value());
  	toolsXml.outFile(toolConvOutputInput->value());
  	
  	unsigned short size = convolveNormalSize->value() ? 0 : ( convolveFirstSize->value() ? 1 : 2);
  	if (size == 0){
  		toolsXml.outImgSize("Normal Size");
  	}else if (size == 1){
  		toolsXml.outImgSize("Size of 1st Image");
  	}else{
  		toolsXml.outImgSize("Size of 2nd Image");
  	}
  
  	toolsXml.saveConvolve( filename );
}

void ToolGUI::writeXmlVariant( const std::string& filename ) {
  cosm::ToolsXml<double> toolsXml;
      
  	toolsXml.imgFile2(toolVariantObjectInput->value());
  	toolsXml.psfFile2(toolVariantPsfInput->value());
  	toolsXml.outFile2(toolVariantOutputInput->value());
  	
  	toolsXml.variantCenteredPSF(toolVariantCenteredPsfCheck->value());
  	
  	toolsXml.variantStrataValue(toolVariantNumberInput->value());
  	toolsXml.variantStrataStart(toolVariantStartInput->value());
  	toolsXml.variantStrataSize(toolVariantSizeInput->value());
  	
  	toolsXml.variantPCAComponents(toolVariantComponentsNumberInput->value());
  	toolsXml.variantPCAStart(toolVariantPSFStartInput->value());
  	toolsXml.variantPCANumbers(toolVariantPSFNumberInput->value());
  	
  	toolsXml.variantStrataModel(toolVariantStrata->value());
  	toolsXml.variantPCAModel(toolVariantPCA->value());
  	
  	toolsXml.saveVariant( filename );
}
