Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

Importing Data From a File


You can import data from several types of files into the iTool Data Manager. The following sections describe the process of importing different types of data.

Importing Image Data

You can visualize image data stored in many common file formats. Common image file formats accepted are:

  • DICOM Image
  • Joint Photographic Experts Group (JPEG)
  • JPEG2000 (JP2 or JPX)
  • Macintosh PICT
  • Portable Network Graphics (PNG)
  • Tag Image File Format (TIFF)
  • Windows Bitmap (BMP)
 

Note
You can also use the iTool's export and export variable features to export image data and variables. For more information on exporting, see Exporting Data.

Note
For more information on the iImage tool and its functions and features, see Working with Images.

Importing ASCII Data

When you open a file containing ASCII data, you must specify the format of the file before the iTool can read the data and place it into the Data Manager. The iTool opens the ASCII Template dialog to allow you to specify the format of the ASCII data.

Note
You can also use the iTool's export and export variable features to export ASCII data and variables. For more information on exporting, see Exporting Data.

The following example opens an ASCII file using the ASCII Template:

  1. From the iTool window open an example file named sine_waves.txt from the examples\data subdirectory of your IDL distribution. You can open the file either by selecting File ® Open or by clicking the Import File button in the Data Manager or Insert Visualization dialog.
  2. The ASCII Template window is displayed:
  3. The first step of the ASCII Template contains the following items:

    • Field Type - select the field type which best describes your data. Choose from fixed width or delimited.
    • Comment Strings to Ignore - allows you to note any comment strings you wish to be ignored.
    • Data Starts at Line - allows you to specify from which line data should first be read.
    • Selected Text File - shows the real data from the selected text file. The option is also given to Get next 50 Lines.
  4. Choose the field type. Here it is delimited by white space.
  5. There are no comment strings to ignore here, and the line upon which to begin your data is 1. Now select Next.
  6. The second step of the ASCII Template contains the following items:

    • Number of Fields Per Line - allows you to specify how many fields should appear per line.
    • Delimiter Between Data Elements - allows you to select the delimiter type between data elements.
    • Value to Assign to Missing Data - allows you to choose a value to assign any missing data.
    • Selected Records - shows the data itself in its desired column-delimited format.
  7. Next, enter the Number of Fields Per Line as two, and the Delimiter Between Data Elements should be set to White Space. Click Next.
  8. The third step of the ASCII Template contains the following items:

    • Name - allows you to name your fields. Default values are Field1, Field2, and so on. You can enter the name into the Name field to the right.
    • Data Type - allows you to set the data type for your fields. You can enter the type by selecting it from the Type drop-down menu.
    • Grouping - allows you the option of joining fields to be manipulated or displayed as a group. You can group certain fields, group all, ungroup certain fields and ungroup all. The default is no grouping.
    • Sample Record - shows you a sample of the configuration you have set.
  9. Next, at step three, the defaults are all correct for the data to visualize. Click Finish and the data is imported (and also in this case, plotted).

Note
Once data has been imported into the iTool and is visible in the Data Manager, there are a few ways to visualize the data. To learn more about visualizing data, see Visualizations.

For more information on using the ASCII file reader, see ASCII_TEMPLATE.

Importing Binary Data

When you open a file containing binary data that is not of a format recognized by any other file reader available to your iTool, you must specify the format of the file before the iTool can read the data and place it into the Data Manager. The iTool opens the Binary Template dialog to allow you to specify the format of the binary data.

Note
If the file contains binary data of a recognized format, such as TIFF or JPEG, the iTool will automatically choose the correct file reader to read the binary data.

Note
You can also use the iTool's export and export variable features to export binary data and variables. For more information on exporting, see Exporting Data.

The following example opens a binary file using the Binary Template:

  1. From the iTool window open an example file named damp_sn.dat from the examples\data subdirectory of your IDL distribution. You can open the file either by selecting File ® Open or by clicking the Import File button in the Data Manager or Insert Visualization dialog. This is a data file containing a damped sine wave with severe high frequency noise.
  2. The Binary Template window is then displayed.
  3. The Template Name is optional, and can be any string.

    The byte order in the file is selected using the using the File's byte ordering: pull-down menu. The choices are:

    • Native - the type of storage method that is native to the machine you are currently running. Little Endian for Intel microprocessor-based machines and Big Endian for Motorola microprocessor-based machines. No byte swapping will be performed.
    • Little Endian - a method of storing numbers so that the least significant byte appears first in the number. Specify this if the original file was created on a machine that uses an Intel microprocessor.
    • Big Endian - a method of storing numbers so that the most significant byte appears first in the number. Specify this if the original file was created on a machine that uses a Motorola microprocessor.
  4. From this template, click New Field.
  5. The New Field dialog contains the following items:

    • The Field Name can be any string.
    • The Type of each Template-specified field is selected from a droplist that offers the following IDL types: byte, integer, long, float, double, complex, dcomplex, uint, ulong, long64 and ulong64. Strings are read as an array of bytes for later conversion to type STRING.
    • Offsets can be specified using integer values, field names, or any valid IDL expression. An absolute integer offset specifies a fixed location (in bytes) from the beginning of the file (or the initial file position for an externally opened file). A relative integer offset specifies a position relative to the current file position pointer after the previous field (if any) is read. Relative offsets are shown in the binary template user interface with a preceding > or < character, to indicate a positive (>) or negative (<) byte offset. Expressions can include the names of fields that will be read before the current field - that is, the field number of the referenced field must be lower than the field number of the field being defined.
    • The Verify field can contain an integer, field name, or any valid IDL expression. Only scalar fields can be verified.
    • The Number of Dimensions of a field can be set via a droplist of values 0 (scalar) to 8 (which is the maximum number of dimensions that an IDL variable can have.) The size of each dimension can be an integer, field name, or any valid IDL expression. Any of the first three dimensions of array data can also be specified to be reversed in order.
    • Click OK to create the new field definition, and repeat to define all necessary fields.

      Note
      If the iTool is running in the IDL Virtual Machine, the Offsets, Verify, and Size fields can contain integers or field names, but not an IDL expression. For additional information on the binary template, see BINARY_TEMPLATE.

  6. In this example, name the field "dampsn". The type is Byte data. The number of dimensions is 1 and the dimension size is 512.
  7. Click OK and then OK again to close the Binary Template dialog. The data is not imported into the Data Manager (and in this case, the plot appears in the iTool window).

Note
Once data has been imported into the iTool and is visible in the Data Manager, there are a few ways to visualize the data. To learn more about visualizing data, see Visualizations.

For more information on the binary file reader, see BINARY_TEMPLATE.

For more information on plotting and plot functions, see Working with Plots.

Importing Shapefile Data

For more information on shapefiles and inserting them into an iTool, see Inserting an IDL Shapefile.

Note
Once data has been imported into the iTool and is visible in the Data Manager, there are a few ways to visualize the data. To learn more about visualizing data, see Visualizations.


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]