Ejemplo n.º 1
0
        /// <summary>
        /// 保存肿瘤库
        /// </summary>
        /// <param name="diagnosis">肿瘤库实体</param>
        /// <param name="editType">1:新增   2:修改</param>
        /// <returns></returns>
        public string SaveTumor(Tumor tumor, string editType)
        {
            SqlParameter[] sqlParam = new SqlParameter[]
            {
                new SqlParameter("@EditType", SqlDbType.VarChar),
                new SqlParameter("@ID", SqlDbType.VarChar),
                new SqlParameter("@MapID", SqlDbType.VarChar),
                new SqlParameter("@StandardCode", SqlDbType.VarChar),
                new SqlParameter("@Name", SqlDbType.VarChar),

                new SqlParameter("@Py", SqlDbType.VarChar),
                new SqlParameter("@Wb", SqlDbType.VarChar),
                new SqlParameter("@Valid", SqlDbType.VarChar),
                new SqlParameter("@Memo", SqlDbType.VarChar)
            };

            sqlParam[0].Value = editType;
            sqlParam[1].Value = tumor.Id;
            sqlParam[2].Value = tumor.Mapid;
            sqlParam[3].Value = tumor.Standardcode;
            sqlParam[4].Value = tumor.Name;

            sqlParam[5].Value = tumor.Py;
            sqlParam[6].Value = tumor.Wb;
            sqlParam[7].Value = tumor.Valid;
            sqlParam[8].Value = tumor.Memo;



            return(m_app.SqlHelper.ExecuteDataSet("EmrSysTable.usp_Edit_Tumor", sqlParam, CommandType.StoredProcedure).Tables[0].Rows[0][0].ToString());
        }
Ejemplo n.º 2
0
    // get value from tumor input from user
    public void ScaleTumorMesh()
    {
        Tumor tumorScript = tumor.GetComponent <Tumor>();

        tumorScript.ScaleTumorMesh(tumorSlider.value);
        tumorRadiusValue.text = tumorSlider.value.ToString();
    }
Ejemplo n.º 3
0
        private static void DrawDetectedTumor(Tumor tumor,
                                              IList <int> tumorPixelData,
                                              IList <int> dataAfter,
                                              IList <int> dataDiff,
                                              int width,
                                              int height,
                                              int fullWidth)
        {
            var tumorBitmapHeight = 0;

            for (var h = height; h < height + tumor.Height; h++)
            {
                var tumorBitmapWidth = 0;

                for (var w = width; w < width + tumor.Width; w++)
                {
                    if (tumorPixelData[tumorBitmapHeight * tumor.Width + tumorBitmapWidth] == tumor.ComputedColor)
                    {
                        if (dataAfter[h * fullWidth + w] == tumor.ComputedColor)
                        {
                            dataDiff[(h * fullWidth) + w] = Convert.ToInt32("0xFFFF0000", 16);
                        }
                    }
                    tumorBitmapWidth++;
                }
                tumorBitmapHeight++;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 将肿瘤库实体中值加载到页面
        /// </summary>
        /// <param name="Tumor"></param>
        private void SetPageValue(Tumor tumor)
        {
            if (tumor == null || tumor.Id == "")
            {
                return;
            }

            this.txtID.Text    = tumor.Id.Trim();
            this.txtMapID.Text = tumor.Mapid.Trim();
            this.txtName.Text  = tumor.Name.Trim();
            this.txtPy.Text    = tumor.Py.Trim();
            this.txtWb.Text    = tumor.Wb.Trim();

            this.cmbValid.SelectedIndex = tumor.Valid;
            this.txtMemo.Text           = tumor.Memo.Trim();
            this.txtStandardCode.Text   = tumor.Standardcode.Trim();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 将页面值加入到肿瘤库实体中
        /// </summary>
        /// <returns></returns>
        private Tumor SetEntityByPageValue()
        {
            Tumor tumor = new Tumor();


            tumor.Id           = this.txtID.Text.Trim();
            tumor.Mapid        = this.txtMapID.Text.Trim();
            tumor.Standardcode = this.txtStandardCode.Text.Trim();
            tumor.Name         = this.txtName.Text.Trim();
            tumor.Py           = this.txtPy.Text.Trim();
            tumor.Wb           = this.txtWb.Text.Trim();

            tumor.Valid = this.cmbValid.SelectedIndex;
            tumor.Memo  = this.txtMemo.Text.Trim();


            return(tumor);
        }
Ejemplo n.º 6
0
        private static int CountPixelsForTumor(Tumor tumor)
        {
            var pixelCounter   = 0;
            var tumorPixelData = tumor.GetTumorAsBitsTable();

            for (var h = 0; h < tumor.Height; h++)
            {
                for (var w = 0; w < tumor.Width; w++)
                {
                    if (tumorPixelData[h * tumor.Width + w] == tumor.ComputedColor)
                    {
                        pixelCounter++;
                    }
                }
            }

            return(pixelCounter);
        }
Ejemplo n.º 7
0
        private static bool DetectTumor(Tumor tumor,
                                        IList <int> tumorPixelData,
                                        int maxFalsePixels,
                                        IList <int> dataAfter,
                                        int width,
                                        int height,
                                        int fullWidth)
        {
            var detectedTumor     = true;
            var falsePixels       = 0;
            var tumorBitmapHeight = 0;

            for (var tumorHeight = height; tumorHeight < height + tumor.Height; tumorHeight++)
            {
                if (!detectedTumor)
                {
                    break;
                }

                var tumorBitmapWidth = 0;

                for (var tumorWidth = width; tumorWidth < width + tumor.Width; tumorWidth++)
                {
                    if (tumorPixelData[tumorBitmapHeight * tumor.Width + tumorBitmapWidth] == tumor.ComputedColor)
                    {
                        if (dataAfter[tumorHeight * fullWidth + tumorWidth] != tumor.ComputedColor)
                        {
                            falsePixels++;

                            if (falsePixels > maxFalsePixels)
                            {
                                detectedTumor = false;
                                break;
                            }
                        }
                    }
                    tumorBitmapWidth++;
                }
                tumorBitmapHeight++;
            }
            return(detectedTumor);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 将gridview中对应行值加载到实体中
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private Tumor SetEntityByDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            Tumor tumor = new Tumor();

            tumor.Id           = dr["Id"].ToString();
            tumor.Mapid        = dr["Mapid"].ToString();
            tumor.Standardcode = dr["Standardcode"].ToString();
            tumor.Name         = dr["Name"].ToString();
            tumor.Py           = dr["Py"].ToString();

            tumor.Wb    = dr["Wb"].ToString();
            tumor.Valid = Convert.ToInt32(dr["Valid"].ToString());
            tumor.Memo  = dr["Memo"].ToString();


            return(tumor);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 保存肿瘤库值
 /// </summary>
 /// <param name="diag"></param>
 /// <returns></returns>
 private bool SaveTumor(Tumor tumor)
 {
     try
     {
         string edittype = "";
         if (m_EditState == EditState.Add)
         {
             edittype = "1";
         }
         else
         {
             edittype = "2";
         }
         m_SysTableManger.SaveTumor(tumor, edittype);
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 根据肿瘤库ID获取肿瘤库实体信息
        /// </summary>
        /// <param name="templet_id"></param>
        public Tumor GetTumor(string markId)
        {
            Tumor tumor = new Tumor();

            DataTable dt = GetDiagnosisOfChinese_Table(markId);

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                tumor.Id           = dr["Id"].ToString();
                tumor.Mapid        = dr["Mapid"].ToString();
                tumor.Standardcode = dr["Standardcode"].ToString();
                tumor.Name         = dr["Name"].ToString();
                tumor.Name         = dr["Name"].ToString();

                tumor.Py    = dr["Py"].ToString();
                tumor.Wb    = dr["Wb"].ToString();
                tumor.Valid = Convert.ToInt32(dr["Valid"].ToString());
                tumor.Memo  = dr["Memo"].ToString();
            }
            return(tumor);
        }
Ejemplo n.º 11
0
        public LungTumorAdder(Tumor tumor, int[] potentialPoints)

        {
            _tumor           = tumor;
            _potentialPoints = potentialPoints;
        }
Ejemplo n.º 12
0
    public void Prediction(Vector3 direction, float ratio)
    {
        double timeBeforeTotal = Time.realtimeSinceStartup;

        client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        client.Connect(IP, Port);
        sendData = System.Text.Encoding.ASCII.GetBytes(direction[0].ToString("G4") + "," + direction[1].ToString("G4") + "," + direction[2].ToString("G4") + "," + ratio.ToString("G4"));

        client.Send(sendData);
        byte[] b = new byte[100];

        int k = client.Receive(b);

        //   Debug.Log("Time for receiving data: " + (timeAfter - timeBefore).ToString());
        double timeAfterTotal = Time.realtimeSinceStartup;
        //    Debug.Log("Time for sending data1: " + (timeAfterTotal - timeBeforeTotal).ToString());

        string     tumorInfor  = System.Text.Encoding.ASCII.GetString(b, 0, k);
        GameObject tumor       = GameObject.Find("Tumor");
        Tumor      tumorScript = tumor.GetComponent <Tumor>();

        tumorScript.PredictionLocationParse(tumorInfor);

        string  szReceived = " ";
        Vector3 vertex;

        StreamReader reader = Reader("F:/Research/FEA simulation for NN/train_patient_specific/disp_prediction.txt");

        szReceived = reader.ReadLine();

        reader.Close();
        //    Debug.Log("Time for sending data2: " + (Time.realtimeSinceStartup - timeBeforeTotal).ToString());

        List <int>     indices     = new List <int>();
        ColorCode      newClor     = new ColorCode();
        ErrorVisualize errorVisual = new ErrorVisualize();
        List <float>   errors      = errorVisual.ReadError("F:/PhD/Preliminary Exam/Paper/gravity/error88.txt");

        if (client.Connected)
        {
            disp = new List <Vector3>();
            string[] words = szReceived.Split(',');

            for (int i = 0; i < words.Length - 4; i += 4)
            {
                int   index = int.Parse(words[i]);
                float x     = float.Parse(words[i + 1]) * scale;
                float y     = float.Parse(words[i + 2]) * scale;
                float z     = float.Parse(words[i + 3]) * scale;
                disp.Add(new Vector3(x, y, z));
                indices.Add(index);
            }
            double timeAfter = Time.realtimeSinceStartup;

            List <Vector3> verticesAfterDisp = MoveVerticesThreshold(vertices, disp, indices);

            double timeBefore = Time.realtimeSinceStartup;
            mesh.vertices = verticesAfterDisp.ToArray();
            //   newClor.AddColor(mesh, disp, indices, trianglesUnique);
            errorVisual.AddColor(mesh, errors, indices, trianglesUnique);
        }
        else
        {
            Debug.Log(" Not Connected");
        }
        // Debug.Log("Time for sending data3: " + (Time.realtimeSinceStartup - timeBeforeTotal).ToString());
        client.Close();
    }
Ejemplo n.º 13
0
 /// <summary>
 /// 根据传入肿瘤库实体删除对应数据
 /// </summary>
 /// <param name="Tumor"></param>
 /// <returns></returns>
 public bool DelTumor(Tumor tumor)
 {
     return(DelTumor(tumor.Id));
 }
Ejemplo n.º 14
0
 public TumorAdder(Tumor tumor)
 {
     _tumor = tumor;
 }