Leadtools.Jpeg2000 Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
FragmentJpxFile Method
See Also  Example
Leadtools.Jpeg2000 Namespace > Jpeg2000Engine Class : FragmentJpxFile Method




inputFileName
String containing the name of the JPX file from which frames are to be extracted.
outputFileName
String containing the name of the fragmented JPX file.
urls
List of UuidUrl specifying the URLs where the fragments are contained.
fragments
List of Fragment specifying the following for each fragment:
  • the codestream index to be fragmented
  • the index for the URL which contains the fragment
  • the offset of the first byte of the fragment within the specified URL
Fragments specified codestreams within a JPEG 2000 part 2 (JPX) file. This method is available in the Document/Medical Toolkits.

Syntax

Visual Basic (Declaration) 
Public Sub FragmentJpxFile( _
   ByVal inputFileName As String, _
   ByVal outputFileName As String, _
   ByVal urls As List(Of UuidUrl), _
   ByVal fragments As List(Of Fragment) _
) 
Visual Basic (Usage)Copy Code
Dim instance As Jpeg2000Engine
Dim inputFileName As String
Dim outputFileName As String
Dim urls As List(Of UuidUrl)
Dim fragments As List(Of Fragment)
 
instance.FragmentJpxFile(inputFileName, outputFileName, urls, fragments)
C# 
public void FragmentJpxFile( 
   string inputFileName,
   string outputFileName,
   List<UuidUrl> urls,
   List<Fragment> fragments
)
Managed Extensions for C++ 
public: void FragmentJpxFile( 
   string* inputFileName,
   string* outputFileName,
   List<UuidUrl>* urls,
   List<Fragment>* fragments
) 
C++/CLI 
public:
void FragmentJpxFile( 
   String^ inputFileName,
   String^ outputFileName,
   List<UuidUrl>^ urls,
   List<Fragment>^ fragments
) 

Parameters

inputFileName
String containing the name of the JPX file from which frames are to be extracted.
outputFileName
String containing the name of the fragmented JPX file.
urls
List of UuidUrl specifying the URLs where the fragments are contained.
fragments
List of Fragment specifying the following for each fragment:
  • the codestream index to be fragmented
  • the index for the URL which contains the fragment
  • the offset of the first byte of the fragment within the specified URL

Example

Visual BasicCopy Code
Leadtools.Jpeg2000.Jpeg2000Engine.FragmentJpxFile
      Private Sub FragmentJpxFileExample()
         Dim engine As New Jpeg2000Engine()

         Dim fileInfo As Jpeg2000FileInformation = engine.GetFileInformation("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx")

         If (1 > FileInfo.CodeStream.GetLength(0)) Then
            Return
         End If

         Dim frames As New List(Of Integer)
         frames.Add(0)
         Dim url As New UuidUrl()
         ReDim url.Flag(2)
         url.Flag(0) = 0
         url.Flag(1) = 0
         url.Flag(2) = 0
         url.Version = 0
         Dim loaction As String = "c:\\codestream.bin"
         Dim data() As Char = loaction.ToCharArray()
         ReDim url.Location(data.GetLength(0))
         data.CopyTo(url.Location, 0)

         Dim urls As New List(Of UuidUrl)
         urls.Add(url)
         Dim _fragment As New Fragment()
         _fragment.CodeStreamIndex = 0
         _fragment.Offset = 0
         _fragment.UrlIndex = 0
         Dim fragments As New List(Of Fragment)
         fragments.Add(_fragment)
         engine.FragmentJpxFile("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx", "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Test.jpx", urls, fragments)
      End Sub
C#Copy Code
Leadtools.Jpeg2000.Jpeg2000Engine.FragmentJpxFile 
      private void FragmentJpxFileExample() 
      { 
         Jpeg2000Engine engine = new Jpeg2000Engine(); 
 
         Jpeg2000FileInformation fileInfo = engine.GetFileInformation(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx"); 
 
         if (1 > fileInfo.CodeStream.GetLength(0)) 
            return; 
 
         List<int> frames = new List<int>(); 
         frames.Add(0); 
         UuidUrl url = new UuidUrl(); 
         url.Flag = new byte[3]; 
         url.Flag[0] = 0; 
         url.Flag[1] = 0; 
         url.Flag[2] = 0; 
         url.Version = 0; 
         String loaction = "c:\\codestream.bin"; 
         char[] data = loaction.ToCharArray(); 
         url.Location = new byte[data.GetLength(0)]; 
         data.CopyTo(url.Location, 0); 
 
         List<UuidUrl> urls= new List<UuidUrl> (); 
         urls.Add(url); 
         Fragment fragment = new Fragment(); 
         fragment.CodeStreamIndex = 0; 
         fragment.Offset = 0; 
         fragment.UrlIndex = 0; 
         List<Fragment> fragments = new List<Fragment> (); 
         fragments.Add(fragment); 
         engine.FragmentJpxFile(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx", @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Test.jpx", urls, fragments); 
      }

Remarks

It is the user to save the fragmented codestreams in their URL locations.

Fragmentation in JPX works by specifying a table of pointers to the individual fragments. Each pointer specifies three things:

  1. The file which contains the fragment. Because multiple fragments across multiple codestreams may be stored in the same file, the format encapsulates all filename/URL data into a table (the Data Reference box). Each fragment specification then references an entry in the data reference table.
  2. The offset of the first byte of the fragment within the specified file. This offset is with respect to the first byte of the file (byte 0) and points directly to the first byte of codestream data for the fragment-- it does NOT point to the start of the box containing that fragment.
  3. The length of the fragment, in bytes.

Fragmentation is an important feature of the JPX file format since it allows applications to implement such features as:
  • The capability to edit an image, resaving the changed tiles to the end of the file.
  • The capability to distribute the image across several disks for faster access.
  • The capability to distribute the image across the internet, allowing only certain customers access to the high quality or high resolution portions of the codestream.
  • The capability to reuse the headers from within a codestream across multiple codestreams (to minimize file overhead when storing similar codestreams witin the same JPX file).

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

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