public void SetOffsetFile(string fn) { HisObject his = new HisObject(); his.LoadDataFromFile(fn); offset_img_ = his.dataList[0]; width_ = his.hisHeader.BRX; height_ = his.hisHeader.BRY; }
public static HisObject OpenFile(string file) { HisObject his = new HisObject(); if (his.LoadDataFromFile(file)) { return(his); } else { return(null); } }
private void ReadFile(string file) { //TiffReader tiff = new TiffReader(); //IOD_RI RI = new IOD_RI(); HisObject His = new HisObject(); //IOD_RD RD = new IOD_RD(); ImageObject img = new ImageObject(); //if (tiff.ReadFile(file)) //{ // imageRows = (uint)tiff.ImageHegiht; // imageColumns = (uint)tiff.ImageWidth; // RefreshScale(); // img.pixelSize = pixelSize; // img.centerX = imageCenterX; // img.centerY = imageCenterY; // ushort[,] image = new ushort[tiff.ImageHegiht, tiff.ImageWidth]; // int sn = 0; // for (int y = 0; y < tiff.ImageHegiht; y++) // { // for (int x = 0; x < tiff.ImageWidth; x++) // { // image[y, x] = tiff.Value[sn++]; // } // } // img.imageData = image; // img.createTime = DateTime.Now; // imgList.Add(img); //} //if (RI.OpenFromFile(file)) //{ // img.pixelSize = RI.RIImage.ImagePlanePixelSpacing[0]; // img.centerX = -RI.RIImage.RTImagePosition[0] / RI.RIImage.ImagePlanePixelSpacing[0]; // img.centerY = RI.RIImage.RTImagePosition[1] / RI.RIImage.ImagePlanePixelSpacing[1]; // img.level = (int)RI.RIImage.WindowCenter; // img.window = (int)RI.RIImage.WindowWidth; // img.imageHeight = RI.ImagePixel.PixelData.GetLength(0); // img.imageWidth = RI.ImagePixel.PixelData.GetLength(1); // ushort[,] image = new ushort[img.imageHeight, img.imageWidth]; // short[,] dv = RI.ImagePixel.PixelData; // for (int y = 0; y < img.imageHeight; y++) // { // for (int x = 0; x < img.imageWidth; x++) // { // image[y,x] = (ushort)dv[y,x]; // } // } // img.imageData = image; // imgList.Add(img); // GC.Collect(); //} if (His.LoadDataFromFile(file)) { if (His.dataList != null) { for (int i = 0; i < His.dataList.Count; i++) { ImageObject imageObj = new ImageObject(); imageObj.ImageData = His.dataList[i]; imageRows = (uint)imageObj.ImageData.GetLength(0); imageColumns = (uint)imageObj.ImageData.GetLength(1); RefreshScale(); imageObj.pixelSize = pixelSize; imageObj.centerX = imageCenterX; imageObj.centerY = imageCenterY; imgList.Enqueue(imageObj); } His.dataList = null; GC.Collect(); } } //else if (RD.OpenFromFile(file))//增加RD图像,2011.12.15,ml //{ // //img.level = 4590; // //img.window = 10000; // if (RD.RD.PixelData.Length > 0) // { // img.pixelSize = RD.RD.PixelSpacing; // img.imageWidth = RD.RD.PixelData[0].GetLength(1); // img.imageHeight = RD.RD.PixelData[0].GetLength(0); // img.centerX = img.imageWidth / 2; //-RDF.fra.ImagePosition[0] / PixelSize; // img.centerY = img.imageHeight / 2;//RDF.fra.ImagePosition[1] / PixelSize; // img.SliceDepth = RD.RD.ImagePosition[1]; // ushort[,] image = new ushort[img.imageHeight, img.imageWidth]; // UInt32[,] rd = RD.RD.PixelData[0]; // for (int i = 0; i < img.imageHeight; i++) // { // for (int j = 0; j < img.imageWidth; j++) // { // image[i, j] = Convert.ToUInt16(rd[i, j] * RD.RD.DoseGridScaling * 1000F); // } // } // img.imageData = image; // imgList.Add(img); // GC.Collect(); // } //} //else //{ // try // { // //Bitmap bm = new Bitmap(file); // //LWList.Add(new Point(-1, -1)); // //imgList.Add(BitmapToUShort(bm)); // //pixelSize = phySize / imgList[0].GetLength(0); // //imageCenterX = phyCenterX / pixelSize; // //imageCenterY = phyCenterY / pixelSize; // } // catch (System.Exception ex) // { // ; // } //} }