LEADTOOLS MRC (Leadtools.Mrc assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
SaveImageT44 Method
See Also 
Leadtools.Mrc Namespace > MrcSegmenter Class : SaveImageT44 Method



image
MRC image to save.
fileName
The output file name.
format
The output file format.
options
Structure that contains the compression information to use when saving the file.
codecs
Extended saving options support

The SaveImageT44 Method is available in LEADTOOLS Document and Medical Imaging toolkits.

image
MRC image to save.
fileName
The output file name.
format
The output file format.
options
Structure that contains the compression information to use when saving the file.
codecs
Extended saving options support
Saves an MRC image contained in an image to a file using the Standard T44 format.

Syntax

Visual Basic (Declaration) 
Public Sub SaveImageT44( _
   ByVal image As RasterImage, _
   ByVal fileName As String, _
   ByVal format As MrcT44ImageFormat, _
   ByVal options As MrcCompressionOptions, _
   ByVal codecs As RasterCodecs _
) 
Visual Basic (Usage)Copy Code
Dim instance As MrcSegmenter
Dim image As RasterImage
Dim fileName As String
Dim format As MrcT44ImageFormat
Dim options As MrcCompressionOptions
Dim codecs As RasterCodecs
 
instance.SaveImageT44(image, fileName, format, options, codecs)
C# 
public void SaveImageT44( 
   RasterImage image,
   string fileName,
   MrcT44ImageFormat format,
   MrcCompressionOptions options,
   RasterCodecs codecs
)
C++/CLI 
public:
void SaveImageT44( 
   RasterImage^ image,
   String^ fileName,
   MrcT44ImageFormat format,
   MrcCompressionOptions options,
   RasterCodecs^ codecs
) 

Parameters

image
MRC image to save.
fileName
The output file name.
format
The output file format.
options
Structure that contains the compression information to use when saving the file.
codecs
Extended saving options support

Example

Visual BasicCopy Code
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
C#Copy Code
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";
}

Remarks

Use this method to save the given image in one of the standard T44 Formats either as a: When format parameter is set to MrcImageFormat.Mrc, *.MRC is the default file extension.

When format parameter is set to MrcImageFormat.MrcTif, *.TIF is the default file extension.

Use the this method to save a file if it is necessary that the file be readable by any application that supports the T44 standard.

Use the MrcSegmenter.SaveImage method to save a file in the LEAD Proprietary T44 format to:
  • Take advantage of the greater number of different segment types available when using the proprietary format.
  • Create smaller files than would be possible by saving them to the standard T44 format.
  • Create higher quality files than would be possible by saving them to the standard T44 format.
Please note that when creating a Standard T44 format file (calling this method using a format parameter set to of MrcT44ImageFormat.MrcT44), only one page can be saved.

If segmentation has been performed, when this method is called any 2-bit text, 2-bit grayscale, and 8-bit grayscale segments are treated as 24-bit image segments. If a text segment contains text over a background, when it is saved using this method the background color is lost. For more information on Mixed Raster Content (MRC) formats, refer to Working with the LEADTOOLS Mixed Raster Content (MRC) .NET Class Library.

When using this method, segments can be any of the following types: Use the Leadtools.Mrc.MrcCompressionOptions structure to set the compression to be used for the different types of segments.

It is best to perform segmentation before calling the MrcSegmenter.SaveImage method.

Segmentation can be performed automatically by calling the MrcSegmenter.SegmentImage method. or performed manually by calling the MrcSegmenter.AddSegment method.

If the options parameter is empty, then the method will use Fax G4 compression for the mask layer, JPEG compression for the 24 bit image segments and 2 for the quality factor. The 2 bit text segments and the grayscale (2 bit and 8 bit) segments will be treated as 24 bit image segments. For more information, refer to Leadtools.Mrc.MrcCompressionOptions.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Mrc requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features