using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace XImaging.Automation.Library.HxDriverLib.Tools
{
public class PlateInfo
{
public int Colums { get; set; }
public int Rows { get; set; }
internal PlateInfo(int cols, int rows)
{
this.Colums = cols;
this.Rows = rows;
}
}
public class PlateHelper
{
///
/// 通过SBS板的数字编号获取对应孔的标准编号
///
/// 孔位数,一般有1孔板、6孔板、24孔板、96孔板、384孔板、1596孔板
/// 孔位的数字编号
/// 孔位的标准编号,如:A1, P12
public static string GetWellName(int well_count, int well_index)
{
if (well_index > well_count || well_index < 0)
return "";
char row;
int col;
switch (well_count)
{
case 1:
return "A1";
case 6:
row = Convert.ToChar((int)((well_index - 1) / 3) + 65);
col = well_index % 3 + 1;
return string.Format("{0}{1}", row, col);
case 12:
row = Convert.ToChar((int)((well_index - 1) / 4) + 65);
col = well_index % 4 + 1;
return string.Format("{0}{1}", row, col);
case 24:
row = Convert.ToChar((int)((well_index - 1) / 6) + 65);
col = well_index % 6 + 1;
return string.Format("{0}{1}", row, col);
case 48:
row = Convert.ToChar((int)((well_index - 1) / 8) + 65);
col = well_index % 8 + 1;
return string.Format("{0}{1}", row, col);
case 96:
row = Convert.ToChar((int)((well_index - 1) / 12) + 65);
col = well_index % 12 + 1;
return string.Format("{0}{1}", row, col);
case 384:
row = Convert.ToChar((int)((well_index - 1) / 24) + 65);
col = well_index % 24 + 1;
return string.Format("{0}{1}", row, col);
case 1536:
return string.Format("{0}", well_index);
default:
return "";
}
}
///
/// 获取SBS板的行列信息
///
/// 孔位数,一般有1孔板、6孔板、24孔板、96孔板、384孔板、1596孔板
///
public static PlateInfo Info(int well_count)
{
switch (well_count)
{
case 1:
return new PlateInfo(1, 1);
case 6:
return new PlateInfo(3, 2);
case 12:
return new PlateInfo(4, 3);
case 24:
return new PlateInfo(6, 4);
case 48:
return new PlateInfo(8, 6);
case 96:
return new PlateInfo(12, 8);
case 384:
return new PlateInfo(24, 16);
case 1536:
return new PlateInfo(48, 32);
default:
return new PlateInfo(0, 0); ;
}
}
}
}