/// <summary> /// すべてのLGN細胞とカメラ画像を描画 /// </summary> /// <param name="RetinalCell"></param> private void LGN_Draw(byte[] RetinalCell) { //LGN細胞への写像を計算するインスタンスを受容野の数だけ作成 ImgDisplay = new ImgDisplayWindow(); LGN_RF0 = new LGN_View(0); LGN_RF1 = new LGN_View(1); LGN_RF2 = new LGN_View(2); LGN_RF3 = new LGN_View(3); LGN_RF4 = new LGN_View(4); LGN_RF5 = new LGN_View(5); LGN_RF6 = new LGN_View(6); LGN_Projector LGN_Projector = new LGN_Projector(); ImgDisplay.Show(); LGN_RF0.Show(); LGN_RF1.Show(); LGN_RF2.Show(); LGN_RF3.Show(); LGN_RF4.Show(); LGN_RF5.Show(); LGN_RF6.Show(); //受容野ごとにLGNへの射影結果を描画 LGN_Projector.Dummy(0, RetinalCell, Ximg_RF0, Yimg_RF0, Xlgn_RF0, Ylgn_RF0, LGN_RF0); LGN_Projector.Dummy(1, RetinalCell, Ximg_RF1, Yimg_RF1, Xlgn_RF1, Ylgn_RF1, LGN_RF1); LGN_Projector.Dummy(2, RetinalCell, Ximg_RF2, Yimg_RF2, Xlgn_RF2, Ylgn_RF2, LGN_RF2); LGN_Projector.Dummy(3, RetinalCell, Ximg_RF3, Yimg_RF3, Xlgn_RF3, Ylgn_RF3, LGN_RF3); LGN_Projector.Dummy(4, RetinalCell, Ximg_RF4, Yimg_RF4, Xlgn_RF4, Ylgn_RF4, LGN_RF4); LGN_Projector.Dummy(5, RetinalCell, Ximg_RF5, Yimg_RF5, Xlgn_RF5, Ylgn_RF5, LGN_RF5); LGN_Projector.Dummy(6, RetinalCell, Ximg_RF6, Yimg_RF6, Xlgn_RF6, Ylgn_RF6, LGN_RF6); ImgDisplay.DrawMask(improc.ToImage(RetinalCell, 1280, 960), mask); }
/// <summary> /// 非同期に描画のリフレッシュを実行 /// </summary> private async void AsyncRefresh1() { await Task.Run(() => { ImgDisplay = new ImgDisplayWindow(); LGN_RF0 = new LGN_View(0); LGN_RF1 = new LGN_View(1); LGN_RF2 = new LGN_View(2); LGN_RF3 = new LGN_View(3); LGN_RF4 = new LGN_View(4); LGN_RF5 = new LGN_View(5); LGN_RF6 = new LGN_View(6); ImgDisplay.Show(); LGN_RF0.Show(); LGN_RF1.Show(); LGN_RF2.Show(); LGN_RF3.Show(); LGN_RF4.Show(); LGN_RF5.Show(); LGN_RF6.Show(); while (true) { if (DrawFlag_IMG) { ImgDisplay.ImgRefresh(); LGN_RF0.DrawRefresh(bmp_RF0); LGN_RF1.DrawRefresh(bmp_RF1); LGN_RF2.DrawRefresh(bmp_RF2); LGN_RF3.DrawRefresh(bmp_RF3); LGN_RF4.DrawRefresh(bmp_RF4); LGN_RF5.DrawRefresh(bmp_RF5); LGN_RF6.DrawRefresh(bmp_RF6); DrawFlag_IMG = false; } if (ReturnFlag) { ImgDisplay.Close(); LGN_RF0.Close(); LGN_RF1.Close(); LGN_RF2.Close(); LGN_RF3.Close(); LGN_RF4.Close(); LGN_RF5.Close(); LGN_RF6.Close(); ReturnFlag = false; return; } } }); }
/// <summary> /// 網膜細胞からLGN細胞への射影結果をビットマップに変換 /// </summary> /// <param name="RF_index"></param> /// <param name="RetinalCell"></param> /// <param name="Ximg"></param> /// <param name="Yimg"></param> /// <param name="Xlgn"></param> /// <param name="Ylgn"></param> /// <returns></returns> public void Dummy(int RF_index, byte[] RetinalCell, List <int> Ximg, List <int> Yimg, List <double> Xlgn, List <double> Ylgn, LGN_View LGN_View) { Bitmap bmp = new Bitmap(600, 600, PixelFormat.Format32bppArgb); //受容野領域の画像データの切り出し LGN.AddRange(CalcLGN(RetinalCell, Ximg, Yimg)); //切り出したLGN細胞をファイル出力 StreamWriter sw = new StreamWriter("LGN_RF0.dat"); foreach (var x in LGN) { //sw.WriteLine(Convert.ToString(x, 2).PadLeft(8, '0')); sw.WriteLine(x); } sw.Close(); //LGNへの射影結果をビットマップに変換 bmp = LGNCell2Bitmap(Xlgn, Ylgn, LGN, 600, 600); //描画処理 LGN_View.DrawLGN(bmp); //リストの初期化 LGN.Clear(); }