Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Mrc
<TestMethod()> _
Public Sub SaveImageT44Example()
' Load an image
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.mrc"))
Dim segmenter As MrcSegmenter = New MrcSegmenter(image, Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.sgm"))
Dim compressionOptions As MrcCompressionOptions = New MrcCompressionOptions()
compressionOptions.MaskCoder = MrcMaskCompression.FaxG31D
compressionOptions.PictureCoder = MrcPictureCompression.Jpeg
compressionOptions.PictureQualityFactor = 10
Try
segmenter.SaveImageT44(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.Mrc"), MrcT44ImageFormat.MrcT44, compressionOptions, codecs)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Mrc;
[TestMethod]
public void SaveImageT44Example()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"MRCSegmentation.mrc"));
MrcSegmenter segmenter = new MrcSegmenter(image,Path.Combine(LEAD_VARS.ImagesDir,"MRCSegmentation.sgm"));
MrcCompressionOptions compressionOptions = new MrcCompressionOptions();
compressionOptions.MaskCoder = MrcMaskCompression.FaxG31D;
compressionOptions.PictureCoder = MrcPictureCompression.Jpeg;
compressionOptions.PictureQualityFactor = 10;
try
{
segmenter.SaveImageT44(image,Path.Combine(LEAD_VARS.ImagesDir,"Out_Result.Mrc"), MrcT44ImageFormat.MrcT44, compressionOptions, codecs);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}