public SampleInfo ReadInfo() { SampleInfo infos = new SampleInfo(); string sConfigFilePath = GetExeFolder() + "\\setting.csv"; if (!File.Exists(sConfigFilePath)) { log.Error("Setting file does not exist!"); return null; } bool bFirstRow = true; using (StreamReader sr = new StreamReader(sConfigFilePath, System.Text.Encoding.Default)) { string sContent = ""; while (true) { sContent = sr.ReadLine(); if (sContent == null) break; if (bFirstRow) { bFirstRow = false; } else { return ExtractInfo(sContent.Split(',').ToList() ); //infos.Add(sContent.Split(',').ToList()); } } } return null; }
public SampleInfo ReadInfo() { SampleInfo infos = new SampleInfo(); string sConfigFilePath = GetExeFolder() + "\\setting.csv"; if (!File.Exists(sConfigFilePath)) { log.Error("Setting file does not exist!"); return(null); } bool bFirstRow = true; using (StreamReader sr = new StreamReader(sConfigFilePath, System.Text.Encoding.Default)) { string sContent = ""; while (true) { sContent = sr.ReadLine(); if (sContent == null) { break; } if (bFirstRow) { bFirstRow = false; } else { return(ExtractInfo(sContent.Split(',').ToList())); //infos.Add(sContent.Split(',').ToList()); } } } return(null); }
private SampleInfo ExtractInfo(List<string> list) { SampleInfo info = new SampleInfo(); for (int i = 0; i < list.Count; i++) { int val = int.Parse(list[i]); switch (i) { case 0: info.ID = val; break; case 1: info.bloodPlasmaSlice = val; break; case 2: info.buffyCoatSlice = val; break; } } return info; }
private void ReadZValues(ref List <SampleInfo> infos) { //1st get the lines count string sReportFile = @"C:\BuffyEx\data\LastReport.txt"; int lineCount = 0; using (StreamReader sr = new StreamReader(sReportFile)) { while (true) { string s = sr.ReadLine(); if (s == null) { break; } lineCount++; } } int nSamples = (lineCount - 1) / 2; for (int i = 0; i < nSamples - 1; i++) { SampleInfo curInfo = new SampleInfo(); curInfo.bloodPlasmaSlice = infos[0].bloodPlasmaSlice; curInfo.buffyCoatSlice = infos[0].buffyCoatSlice; curInfo.ID = infos.Count + 1; infos.Add(curInfo); } using (StreamReader sr = new StreamReader(sReportFile)) { string sContent = ""; bool bFirstRow = true; int nHeightColumn = 0; int curRow = 0; while (true) { sContent = sr.ReadLine(); if (sContent == null) { break; } if (bFirstRow) { bFirstRow = false; nHeightColumn = GetHeightColumn(sContent); } else { int infoIndex = (curRow - 1) % nSamples; if (infoIndex < infos.Count) { string[] vals = sContent.Split('\t'); if (curRow < (lineCount + 1) / 2) { infos[infoIndex].Z1 = double.Parse(vals[nHeightColumn]) * 10; } else { infos[infoIndex].Z2 = double.Parse(vals[nHeightColumn]) * 10; } } } curRow++; } } }
private void generateForSample(SampleInfo sampleInfo) { string sOutput = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\output\\"; //create folders if (!Directory.Exists(sOutput)) Directory.CreateDirectory(sOutput); sOutput = sOutput + "\\"+ sampleInfo.ID.ToString()+"\\"; if (!Directory.Exists(sOutput)) Directory.CreateDirectory(sOutput); double r = pipettingSetting.r_mm; double area = 3.14159265 * r * r; double volumeBloodPlasma = Math.Abs(( sampleInfo.Z1 - sampleInfo.Z2) * area ); //ul Write2File(sOutput + "plasmaDstSliceCount.txt", sampleInfo.bloodPlasmaSlice.ToString()); Write2File(sOutput + "buffyDstSliceCount.txt", sampleInfo.buffyCoatSlice.ToString()); Write2File(sOutput + "buffyLayerCount.txt", pipettingSetting.buffyAspirateLayers.ToString()); Write2File(sOutput + "plasmaEachVolume.txt", (volumeBloodPlasma/sampleInfo.bloodPlasmaSlice).ToString()); Write2File(sOutput + "eachLayerPointCount.txt", pipettingSetting.pointsCount.ToString()); Write2File(sOutput + "Z1.txt", sampleInfo.Z1.ToString()); Write2File(sOutput + "Z2.txt", sampleInfo.Z2.ToString()); using(StreamWriter sw = new StreamWriter(sOutput + "xyMoves.txt")) { List<POINT>pts = GenerateAspiratePts(r); //for each layer, move x,y then aspirate, then move z for (int layer = 0; layer < sampleInfo.buffyCoatSlice; layer++) { //bool needDispense = (layer + 1) % (sampleInfo.buffyCoatSlice / 2) == 0; foreach (POINT pt in pts) { log.InfoFormat("Pt position is:{0} , {1} ", pt.x, pt.y); if( layer == 0) sw.WriteLine(string.Format("{0},{1}",(int)pt.x,(int)pt.y)); } } } }
private void ReadZValues(ref List<SampleInfo> infos) { //1st get the lines count string sReportFile = @"C:\BuffyEx\data\LastReport.txt"; int lineCount = 0; using (StreamReader sr = new StreamReader(sReportFile)) { while(true) { string s = sr.ReadLine(); if( s == null) break; lineCount++; } } int nSamples = (lineCount - 1) / 2; for (int i = 0; i < nSamples - 1; i++) { SampleInfo curInfo = new SampleInfo(); curInfo.bloodPlasmaSlice = infos[0].bloodPlasmaSlice; curInfo.buffyCoatSlice = infos[0].buffyCoatSlice; curInfo.ID = infos.Count+1; infos.Add(curInfo); } using (StreamReader sr = new StreamReader(sReportFile)) { string sContent = ""; bool bFirstRow = true; int nHeightColumn = 0; int curRow = 0; while (true) { sContent = sr.ReadLine(); if (sContent == null) break; if (bFirstRow) { bFirstRow = false; nHeightColumn = GetHeightColumn(sContent); } else { int infoIndex = (curRow - 1) % nSamples; if (infoIndex < infos.Count) { string[] vals = sContent.Split('\t'); if (curRow < (lineCount + 1) / 2) infos[infoIndex].Z1 = double.Parse(vals[nHeightColumn])*10 ; else infos[infoIndex].Z2 = double.Parse(vals[nHeightColumn])*10 ; } } curRow++; } } }