Table of Contents

fScan Reference Manual, Chapter 2 (CmdLineOptions): raw

Raw -- Save a copy of raw input data prior to any processing steps

usage: -raw rawtarget flag

The RAW command is typically used when input data are being acquired and analyzed in real-time. It allows you to save a copy of the raw input data (before any processing) as fast as the data are acquired. It is designed to act as a filter, writing out a copy of the data at the input, without disrupting any subsequent analysis steps.

The RAWTARGET can either be a disk file name, or it can be a network socket connection. If it is a filename the data set will be stored in a file with that name, just as it would be if you wrote the file using the OUTPUT command. The main difference is that the images are written as read, rather than all read first and then all written afterwards.

The FLAG parameter can be used to specify some transfer options.
FLAG (combine options by adding values):

Writing to a network port socket

To use a network connection for writing raw data, you should specify RAWTARGET in the form:

Computer:PortNum

where Computer can be either in name format (e.g. mycomp.biac.duke.edu) or IP address (e.g. 10.152.25.1). PortNum is the socket port number associated with the process that will be receiving the data. For example:

raw cajal.dhe.duke.edu:5666

Data transmitted through socket connections can include both text and binary data. All text data is organized in XML packets, and all binary data is preceded by an XML header packet before every binary record.

XML data packets use the following syntax:

<NAM AttributeLIST />\n\r

Each packet starts with a '<' character followed by a packet name, and ends with either '/>' or '</NAM>'.
Two extra control characters (“\n\r” – newline and carriage-return) are added after each XML packet. If the header is followed by binary data, the binary block begins after the “\n\r” pair.

The ATTRIBUTELIST can contain any number of qualifiers in standard XML attribute format, Anam=“Value”. Space, tab, newline, and carriage-return characters within an XML packet serve as separators and can be otherwise ignored.

Standard XML data packets include the following:

Initialize a connection:
  <opn c="CHAN" t="TYPE" x="NX" y="NY" z="NZ" v="NV"/>
     CHAN - Channel number assigned on opening (default=1)
            All related data use the same channel
     TYPE - Data type; 'i' for image data 
     X - X dimension (pixels)
     Y - Y dimension (pixels)
     Z - Z dimension (slices)
     V - Volume (time) dimension (time points)
Transfer a data record:
  <rec c="CHAN" t="TYPE" f="FMT" v="VOL" z="SLICE" n="NBYTES"/>
     CHAN - Channel number for data set (default=1)
     TYPE - Data type; 'i' for image data (default=i)
     FMT - Data format; 'b' for binary, 't' for text data (default=b)
     VOL - Volume number; time sample, 1-NV (default=1)
     SLICE - Slice number within volume 1-NZ (default=1)
     NBYTES - Number of bytes of data in record (default=0) 
  Following the <REC/> header (and "\n\r") there will be NBYTES of binary data.
End of data:
  <end c="CHAN" n="NRECS"/>
     CHAN - Channel number
     NRECS - Number of records (<REC> blocks) transmitted

An important advantage of using XML is that the packet and attribute options can be expanded as needed. Unrecognized packets or attributes should be ignored.

See Also:
Connect, Output, Input

fScan Home, fScan Manual, CmdLineOptions, Manual Help