コード例 #1
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Multiply image by a constant.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="value"></param>
 public void Multiply(Pi2Image img, float value)
 {
     PiLib.RunAndCheck(Handle, $"multiply({img.ImageName}, {value.ToString(CultureInfo.InvariantCulture)})");
 }
コード例 #2
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Multiply two images and place the result into the first image.
 /// </summary>
 /// <param name="img">The first image. The result will be placed to this image.</param>
 /// <param name="img2">The seconds image.</param>
 /// <param name="allowBroadcast">Set to true to allow size of parameter image differ from size of input image. If there is a need to access pixel outside of parameter image, the nearest value inside the image is taken instead.If set to false, dimensions of input and parameter images must be equal. If set to true, the parameter image is always loaded in its entirety in distributed processing mode.</param>
 public void Multiply(Pi2Image img, Pi2Image img2, bool allowBroadcast = false)
 {
     PiLib.RunAndCheck(Handle, $"multiply({img.ImageName}, {img2.ImageName}, {allowBroadcast.ToString(CultureInfo.InvariantCulture)})");
 }
コード例 #3
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Add two images and place the result to the first one.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="img2"></param>
 public void Add(Pi2Image img, Pi2Image img2)
 {
     PiLib.RunAndCheck(Handle, $"add({img.ImageName}, {img2.ImageName})");
 }
コード例 #4
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Subtract an image from a constant.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="value"></param>
 public void InvSubtract(Pi2Image img, float value)
 {
     PiLib.RunAndCheck(Handle, $"invsubtract({img.ImageName}, {value.ToString(CultureInfo.InvariantCulture)})");
 }
コード例 #5
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Converts img to specified data type in-place.
 /// Does not scale pixel values.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="dt"></param>
 public void Convert(Pi2Image img, ImageDataType dt)
 {
     PiLib.RunAndCheck(Handle, $"convert({img.ImageName}, {dt})");
 }
コード例 #6
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Make pixels of img equal those of img2.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="img2"></param>
 public void Set(Pi2Image img, Pi2Image img2)
 {
     PiLib.RunAndCheck(Handle, $"set({img.ImageName}, {img2.ImageName})");
 }
コード例 #7
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Performs backprojection part of filtered backprojection reconstruction.
 /// </summary>
 /// <param name="preprocessed">Projections processed using FBPPreprocess command.</param>
 /// <param name="output">Reconstruction will be placed in this image.</param>
 /// <param name="settings"></param>
 public void FBP(Pi2Image preprocessed, Pi2Image output, string settings)
 {
     PiLib.RunAndCheck(Handle, $"fbp({preprocessed.ImageName}, {output.ImageName}, {settings})");
 }
コード例 #8
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Create an wx1x1 image that contains values of filter for use in filtered backprojection.
 /// </summary>
 /// <param name="output">Output image.</param>
 /// <param name="size">Desired size or zero to use size of output image.</param>
 /// <param name="filterType">Type of filter. Supported values are Ramp1, Ramp2, Shepp-Logan, Cosine, Hamming, and Hann.</param>
 /// <param name="cutoff">Filter cutoff frequency.</param>
 public void CreateFBPFilter(Pi2Image output, int size = 100, string filterType = "Ramp1", float cutoff = 1.0f)
 {
     PiLib.RunAndCheck(Handle, $"createfbpfilter({output.ImageName}, {size}, {filterType}, {cutoff.ToString(CultureInfo.InvariantCulture)})");
 }
コード例 #9
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Performs FBP preprocessing for given projections.
 /// </summary>
 /// <param name="projections">Flat-field corrected projection data. This image is not modified.</param>
 /// <param name="preprocessed">This image will store the preprocessed projection data.</param>
 /// <param name="settings"></param>
 public void FBPPreprocess(Pi2Image projections, Pi2Image preprocessed, string settings)
 {
     PiLib.RunAndCheck(Handle, $"fbppreprocess({projections.ImageName}, {preprocessed.ImageName}, {settings})");
 }
コード例 #10
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Writes the given image to a .tif file.
 /// No extension is appended to the file name.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="filename"></param>
 public void WriteTif(Pi2Image img, string filename)
 {
     PiLib.RunAndCheck(Handle, $"writetif({img.ImageName}, {filename})");
 }
コード例 #11
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Create a disk-mapped image from existing .raw file or create a new .raw file if corresponding file does not exist.
 /// If data type and dimensions are not specified, the image file name must contain dimensions of the image, i.e. it must be in format corresponding to image_name_123x456x789.raw.
 /// </summary>
 /// <param name="image">The mapped image is placed into this image object. NOTE: Changes made to the image are IMMEDIATELY reflected on disk.</param>
 /// <param name="filename">Name of image file to map.</param>
 /// <param name="dataType">Data type of the image. Specify empty value to infer data type from image dimensions</param>
 /// <param name="width">Width of the image. Omit width, height and depth to infer dimensions from file name.</param>
 /// <param name="height">Height of the image. Omit width, height and depth to infer dimensions from file name.</param>
 /// <param name="depth">Depth of the image. Omit width, height and depth to infer dimensions from file name.</param>
 public void MapRaw(Pi2Image image, string filename, ImageDataType dataType = ImageDataType.Unknown, int width = 0, int height = 0, int depth = 0)
 {
     PiLib.RunAndCheck(Handle, $"mapraw({image.ImageName}, {filename}, {dataType}, {width}, {height}, {depth})");
 }
コード例 #12
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Read image file to given image.
 /// </summary>
 /// <param name="target"></param>
 /// <param name="filename"></param>
 public void Read(Pi2Image target, string filename)
 {
     PiLib.RunAndCheck(Handle, $"read({target.ImageName}, {filename})");
 }
コード例 #13
0
ファイル: Pi2.cs プロジェクト: dreamplayer-zhang/pi2
 /// <summary>
 /// Makes sure that the size of the image equals the given dimensions.
 /// Reallocates the image in case of size difference.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="depth"></param>
 public void EnsureSize(Pi2Image img, int width = 1, int height = 1, int depth = 1)
 {
     PiLib.RunAndCheck(Handle, $"ensuresize({img.ImageName}, {width}, {height}, {depth})");
 }