public DataTable GetAllCalendarItems() { var codePanel = new DataTable(); //CodePanel Data codePanel.Columns.Add ( "Subject", typeof(string)); codePanel.Columns.Add ( "Location", typeof(string)); codePanel.Columns.Add ( "StartTime", typeof(DateTime)); codePanel.Columns.Add ( "EndTime", typeof(DateTime)); codePanel.Columns.Add ( "StartDate", typeof(DateTime)); codePanel.Columns.Add ( "EndDate", typeof(DateTime)); codePanel.Columns.Add ( "AllDayEvent", typeof(bool)); codePanel.Columns.Add ( "Body", typeof(string)); ListViewContacts = new ListView(); OApp = new Application(); ONs = OApp.GetNamespace("MAPI"); OCalenderFolder = ONs.GetDefaultFolder(OlDefaultFolders.olFolderCalendar); OutlookCalendarItems = OCalenderFolder.Items; OutlookCalendarItems.IncludeRecurrences = true; // DataTable CodePanel = new DataTable(); foreach (AppointmentItem item in OutlookCalendarItems) { DataRow row = codePanel.NewRow(); row["Subject"] = item.Subject; row["Location"] = item.Location; row["StartTime"] = item.Start.TimeOfDay.ToString(); row["EndTime"] = item.End.TimeOfDay.ToString(); row["StartDate"] = item.Start.Date; row["EndDate"] = item.End.Date; row["AllDayEvent"] = item.AllDayEvent; row["Body"] = item.Body; codePanel.Rows.Add(row); } codePanel.AcceptChanges(); foreach (DataRow dr in codePanel.Rows) { var lvi = new ListViewItem(dr["Subject"].ToString()); lvi.SubItems.Add(dr["Location"].ToString()); lvi.SubItems.Add(dr["StartTime"].ToString()); lvi.SubItems.Add(dr["EndTime"].ToString()); lvi.SubItems.Add(dr["StartDate"].ToString()); lvi.SubItems.Add(dr["EndDate"].ToString()); lvi.SubItems.Add(dr["AllDayEvent"].ToString()); lvi.SubItems.Add(dr["Body"].ToString()); ListViewContacts.Items.Add(lvi); } OApp = null; ONs = null; return(codePanel); }
/// <summary> /// LGMDPlus model visual processing /// </summary> /// <param name="img1"></param> /// <param name="img2"></param> /// <param name="t"></param> public void LGMDPlus_Processing(byte[,,] img1, byte[,,] img2, int t) { float tmp_sum = 0; float tmp_ffi = 0; int cur_frame = t % ONs.GetLength(2); int pre_frame = (t - 1) % ONs.GetLength(2); int cur_spi = t % spike.Length; float sigma, sca, localW; //PHOTORECEPTORS for (int y = 0; y < this.height; y++) { for (int x = 0; x < width; x++) { photoreceptors[y, x, cur_frame] = HighpassFilter(img1[y, x, 0], img2[y, x, 0]); tmp_ffi += Math.Abs(photoreceptors[y, x, cur_frame]); } } //attention //SPATIAL LOW-PASS FILTERING blurred = GaussBlur(photoreceptors, gauss_blur_kernel_width, gauss_blur_kernel, cur_frame); //attention //FFI TUNING ffi[cur_frame] = tmp_ffi / Ncell; ffi[cur_frame] = LowpassFilter(ffi[cur_frame], ffi[pre_frame], lp_FFI); sigma = FFIshapesDelayCoefficient(ffi[cur_frame]); temporalTuning(raw_tau_G, ref dyn_tau_G, ref dyn_lp_G, sigma); dyn_bias = FFIMediation(ffi[cur_frame], W_base); //ON/OFF MECHANISMS for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { ons[y, x, cur_frame] = HRplusDC_ON(ons[y, x, pre_frame], blurred[y, x]); offs[y, x, cur_frame] = HRplusDC_OFF(offs[y, x, pre_frame], blurred[y, x]); } } //SPATIOTEMPORAL PROCESSING IN DUAL-PATHWAYS for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { localW = 1 - BiasMat[y, x]; if (localW < W_min) { localW = W_min; } Inh_ON[y, x] = Convolution(y, x, ons, ConvK, cur_frame, pre_frame, lp_E); Inh_OFF[y, x] = Convolution(y, x, offs, ConvK, cur_frame, pre_frame, lp_E); //attention //dyn_bias = FFIMediation(ffi[cur_frame], (1 - BiasMat[y, x])); //S_on = sCellValue(ons[y, x, cur_frame], Inh_ON[y, x], dyn_bias); //S_off = sCellValue(offs[y, x, cur_frame], Inh_OFF[y, x], dyn_bias); S_on = sCellValue(ons[y, x, cur_frame], Inh_ON[y, x], localW * dyn_bias); S_off = sCellValue(offs[y, x, cur_frame], Inh_OFF[y, x], localW * dyn_bias); //S_on = sCellValue(ons[y, x, cur_frame] * BiasMat[y, x], Inh_ON[y, x], dyn_bias); //S_off = sCellValue(offs[y, x, cur_frame] * BiasMat[y, x], Inh_OFF[y, x], dyn_bias); scells[y, x] = SupralinearSummation(S_on, S_off); } } for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { gcells[y, x, cur_frame] = Convolving(y, x, scells, W_g); } } sca = Scale(cur_frame); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { gcells[y, x, cur_frame] = gCellValue(scells[y, x], gcells[y, x, cur_frame], sca); //latency of input local excitation gcells[y, x, cur_frame] = LowpassFilter(gcells[y, x, cur_frame], gcells[y, x, pre_frame], dyn_lp_G); tmp_sum += gcells[y, x, cur_frame]; } } //MEMBRANE POTENTIAL mp[cur_frame] = tmp_sum; /* * if (ffi[cur_frame] > 1) * mp[cur_frame] /= (float)(Math.Sqrt(ffi[cur_frame])); */ smp[cur_frame] = SigmoidTransfer(mp[cur_frame]); //SPIKE FREQUENCY ADAPTATION sfa[cur_frame] = SFA_HPF(sfa[pre_frame], smp[pre_frame], smp[cur_frame]); //SPIKING spike[cur_spi] = Spiking(sfa[cur_frame]); //RATE spiRate = spikeFrequency(spike); //Collision Recognition if (collision == 0) { collision = collisionDetecting(spiRate, Tsr); //attention if (collision == 1) { activationTiming = t; } } //Console.WriteLine("{0} {1:F} {2:F} {3:F} {4:F} {5} {6:F} {7:F} {8:F}", t, mp[cur_frame], smp[cur_frame], sfa[cur_frame], ffi[cur_frame], spike[cur_spi], spiRate, dyn_bias, dyn_tau_G); Console.WriteLine("{0} {1:F} {2:F} {3:F} {4:F} {5} {6:F} {7}", t, mp[cur_frame], smp[cur_frame], sfa[cur_frame], ffi[cur_frame], spike[cur_spi], spiRate, collision); }
/// <summary> /// LGMD2 based visual processing /// </summary> /// <param name="img1"></param> /// <param name="img2"></param> /// <param name="t"></param> public void LGMD_Processing(byte[,,] img1, byte[,,] img2, int t) { float tmp_sum = 0; int cur_frame = t % ONs.GetLength(2); int pre_frame = (t - 1) % ONs.GetLength(2); int cur_spi = t % SPIKE.Length; float tmp_ffi = 0; float sigma, sca; //PHOTORECEPTORS for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { PHOTOS[y, x, cur_frame] = HighpassFilter(img1[y, x, 0], img2[y, x, 0]); tmp_ffi += Math.Abs(PHOTOS[y, x, cur_frame]); } } /*attention!*/ //FFI TUNING FFI[cur_frame] = tmp_ffi / Ncell; FFI[cur_frame] = LowpassFilter(FFI[cur_frame], FFI[pre_frame], lp_FFI); sigma = FFIshapesDelayCoefficient(FFI[cur_frame]); temporalTuning(raw_tau_E, ref tau_E, ref lp_E, sigma); this.dyn_bias = FFIMediation(FFI[cur_frame], W_i_low); //dyn_bias = W_i_low; /*the new tuning mechanism*/ //ON AND OFF RECTIFYING for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { ONs[y, x, cur_frame] = HRplusDC_ON(ONs[y, x, pre_frame], PHOTOS[y, x, cur_frame]); OFFs[y, x, cur_frame] = HRplusDC_OFF(OFFs[y, x, pre_frame], PHOTOS[y, x, cur_frame]); } } //SPATIOTEMPORAL PROCESSING IN DUAL-PATHWAYS for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { INH_ON[y, x] = Convolution(y, x, ONs, Conv_Low, cur_frame, pre_frame, lp_Large); INH_OFF[y, x] = Convolution(y, x, OFFs, Conv_Low, cur_frame, pre_frame, lp_Large); S_on = sCellValue(ONs[y, x, cur_frame], INH_ON[y, x], dyn_bias); S_off = sCellValue(OFFs[y, x, cur_frame], INH_OFF[y, x], dyn_bias); S_CELLS[y, x] = SupralinearSummation(S_on, S_off); } } for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { G_CELLS[y, x, cur_frame] = Convolving(y, x, S_CELLS, W_g); } } sca = Scale(cur_frame); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { G_CELLS[y, x, cur_frame] = gCellValue(S_CELLS[y, x], G_CELLS[y, x, cur_frame], sca); //latency of input local excitation G_CELLS[y, x, cur_frame] = LowpassFilter(G_CELLS[y, x, cur_frame], G_CELLS[y, x, pre_frame], lp_E); tmp_sum += G_CELLS[y, x, cur_frame]; } } //MEMBRANE POTENTIAL MP[cur_frame] = tmp_sum; SMP[cur_frame] = SigmoidTransfer(MP[cur_frame]); //SPIKE FREQUENCY ADAPTATION SFA[cur_frame] = SFA_HPF(SFA[pre_frame], SMP[pre_frame], SMP[cur_frame]); //SPIKING SPIKE[cur_spi] = Spiking(SFA[cur_frame]); //RATE SPIKERATE = spikeFrequency(SPIKE); Console.WriteLine("{0} {1:F} {2:F} {3:F} {4:F} {5} {6:F} {7:F} {8:F}", t, this.MP[cur_frame], this.SMP[cur_frame], this.SFA[cur_frame], this.FFI[cur_frame], this.SPIKE[cur_spi], this.SPIKERATE, this.DYNAMIC_BIAS, this.TAU_EXC); }