#pragma once #include "afxwin.h" #include "..\..\..\resource.h" #include "afxcmn.h" #include <iostream> #include "DS_1b_cube.h" #include "math.h" #include "extract.h" #include "threshold.h" #include "binarize.h" #include <fstream> #include "bmp_io.h" #include "DirectoryBrowser.h" #include "file_IO_lib.h" //#include "RW_Dialog.h" //for dlg refresh in random walk match mode //filters #include "FiltersWrapper.h" // PoroMediaDialogShare dialog using namespace std; class PoroMediaDialogShare { public: PoroMediaDialogShare(); ~PoroMediaDialogShare(); public: void BindCommonInputFields(CDataExchange* pDX); void InitCommonInputFields(); void UpdateDirFileField(); int LimitFieldValueSE(CEdit* field_SE_slice_cntrl, int input_num, int plane); int LimitFieldValueWidth(CEdit* field_width_slices_cntrl, int num_slices, int start_indx, int plane); int GetIntValFromField(CEdit* field_cntrl); long GetLongValFromField(CEdit* field_cntrl); double GetFloatValFromField(CEdit* field_cntrl); void SetIntValField(CEdit* field_cntrl, int val); void SetLongValField(CEdit* field_cntrl, long val); void SetFloatValField(CEdit* field_cntrl, double val); void InitLeftBracket(int input_num); void UpdateLeftBracket(); //these all deal with common manipulation/autocalc of the GUI void ClickedInputDirectory(); void ClickedInputDirectory_auto( char *directory_name_str, char *file_name_str ); void ClickedWorkDirectory(); void EditStartSlice(); void EditWidthSlices(); void EditEndSlice(); void EditStartx(); void EditWidthx(); void EditEndx(); void EditStarty(); void EditWidthy(); void EditEndy(); void EditManualThreshold(); void ChangeComboThresholding(); void DisableCommonInputs(); void EnableCommonInputs(); void StopRequest(); void StopConfirm(); //assuming everything is filled out and correct, returns input in a DS 1 bit form DS_1b_cube* Dlg_Input_to_cDS(); DS_cube* Dlg_Input_to_DS(); //writes a header from user input int Write_Result_Header(char* result_file); public: enum { X_PLANE = 0, Y_PLANE, S_PLANE }; //these variable names do the same in all dialogs CButton button_OK; CButton button_CANCEL; CButton button_STOP; // // input and output controls and variables // CButton button_directory_input; CEdit field_directory_and_file_input_cntrl; CString field_directory_and_file_input_str; CButton button_directory_output; CEdit field_directory_work_cntrl; CString field_directory_work_str; CEdit field_name_output_cntrl; CString field_name_output_str; // // input parameter variables and controls // CEdit field_start_slice_cntrl; int field_start_slice_int; CEdit field_start_X_cntrl; int field_start_X_int; CEdit field_start_Y_cntrl; int field_start_Y_int; CEdit field_width_slices_cntrl; int field_width_slices_int; CEdit field_width_X_cntrl; int field_width_X_int; CEdit field_width_Y_cntrl; int field_width_Y_int; CEdit field_end_slice_cntrl; int field_end_slice_int; CEdit field_end_X_cntrl; int field_end_X_int; CEdit field_end_Y_cntrl; int field_end_Y_int; CButton check_auto_calc_params; CEdit field_pixel_size_cntrl; float field_pixel_size_float; // // Binarization Settings // CButton check_image_is_inverted; CComboBox combo_threshold_method; CEdit field_manual_threshold; int field_manual_threshold_int; CEdit txt_field_threshold_val; CEdit txt_field_threshold_sensitive; CProgressCtrl pbar_threshold_sensitivity; bool skip_binarization; // // save options // //present in all dialogs CButton check_save_raw_stack; CButton check_save_cbin_stack; //only modified through preprocessing bool check_save_raw_files_bool; // //FILTERS // bool save_intermediate_results; //contrast CButton check_filter_contrast_enable; short filter_contrast_percentage; //convolve CButton check_filter_convolve_enable; bool filter_convolve_savebounds; short filter_convolve_type; float filter_convolve_radius; //aniso CButton check_filter_aniso_enable; bool filter_aniso_fast; bool filter_aniso_conboost; bool filter_aniso_savebounds; unsigned short int filter_aniso_K; float filter_aniso_TAU, filter_aniso_TAU_defVon, filter_aniso_TAU_defVoff; unsigned short int filter_aniso_K_defVon, filter_aniso_K_defVoff; bool filter_aniso_K_var; unsigned short int filter_aniso_iterations; unsigned char filter_aniso_midpoint; short filter_aniso_diff_coef; float filter_aniso_radius; //voxel removal CButton check_filter_voxrem_enable; bool filter_voxrem_removal_run_4_pore; bool filter_voxrem_removal_run_4_fiber; long filter_voxrem_pore_vox_vol; double filter_voxrem_pore_um_vol; long filter_voxrem_fiber_vox_vol; double filter_voxrem_fiber_um_vol; //close CButton check_filter_close_enable; short filter_close_iterations; short filter_close_neighs_ext; short filter_close_neighs_non; short filter_close_neighs; bool filter_close_extended; // //progress bar, progress text, memory required txt // CEdit txt_field_progress; CProgressCtrl pbar_simulation_progress; //for memory usage estimate CEdit txt_field_req_mem; float req_mem_byte_multiplier; //input directory and file strings, file extension type, should be initialized after input file is selected by user CString input_file_name; CString input_file_name_cut; // file name after '[' and everythin after words deleted CString input_directory_name; int input_file_ext; //enable/disable advanced options, and user threshold bool flag_add_options; bool flag_manual_threshold; // //valid for NON-STACK input files only // //index of '[' in the file name int left_bracket_indx; //the number of digits an input file has attached int max_dig_cnt; //the valid number of first file (not counting the '0' up front) int cur_dig_cnt; //the start variables of slice, X, Y, initialized to -1 int first_slice_indx; int first_X_indx; int first_Y_indx; //contains max value for depth of each plane int max_XY_depth; int max_XZ_depth; int max_YZ_depth; // these are by default the MAX_NUM_LIMIT, but get changed for BMP images int max_X_size; int max_Y_size; //mutex variable to differentiate between user changed fields, and program changed fields bool program_generated; //stop command, worker threads check this variable, and stop if it is set //note, thread must set stop_request back to FALSE after the signal is recieved, otherwise GUI will hang bool stop_request; //used to specify what components of the shared dialog are UNUSED #define BINARIZE_CONTROLS 1 #define FILTER_CONTROLS 2 #define FILESAVE_CONTROLS 4 #define PROGRESS_CONTROLS 8 #define MEMORY_CONTROLS 16 int dialog_inactive_flags; inline bool is_control_enabled(int cflag) {return ( (dialog_inactive_flags & cflag) ? (false) : (true) );} };