BDWINDOW

Section: User Commands (1)
Updated: 23 January 1988
Index Return to Main Contents
 

NAME

bdwindow - window on pixels in depth  

SYNOPSIS

bdwindow [-H][-sshift][-AAND_mask][-OOR_mask][-XXOR_mask][-wpixel_size]
          < infile > outfile

         [-i infile] [-o outfile]
 

DESCRIPTION

bdwindow windows in bit depth on individual pixels. It operates on 32-bit integers. There are two ``modes'' of operation in bdwindow: one treats the file as ``integers in, integers out,'' while the other one works in terms of ``integers in, rgb out.'' The basic four operations are bit shift, bitwise and, bitwise or, and bitwise xor. For shifting, a positive number indicates a left shift and a negative one a right shift; the other three options take masks in decimal and hexadecimal arguments alike.

The ``integers in, integers out'' mode is quite simple: it reads in a longword, performs operations in the order shift, and, or, xor, and writes the longword out again. If the -w option is invoked, the program will only write out the lower 1, 2, or 3 bytes of the resulting word.

The ``integers in, rgb out'' mode is a bit different. An integer is read in and then triplicated. Each of these three integers can then have the standard operations performed on it, after which its lowest 8 bits placed into another integer for output. In this output word In the output word red starts at 0, green at 8, and blue at 16. This ``rgb'' out mode is a side effect of specifying the r, g or b subargument to s, a, o, or x. To get rgb output with no bit operations, give an s subargument of zero. For example, to load 8 bit pixels (stored in ints) into an rgb output format:
bdwindow -sr 0 -sg 0 -sb0 <int_8bit_in > rgb_3x8bit_out

Examples:
Shift the high 8 bits of 12 bit pixels to the low 8 bits:
bdwindow -H -i smd.gel.hips -o smd.gel.hips.8 -s -4

Bdwindow operating on a file of 16-bit pixels (in 32 bit words) could place the upper eight bits in blue, the middle eight in green, and the lower eight in red by selecting "-sb 8 -sg 4". So,
0000000000000000 i16 i15 i14 i13 i12 i11 i10 i9 i8 i7 i6 i5 i4 i3 i2 i1
would internally go to:
0000000000000000 r16 r15 r14 r13 r12 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1
0000000000000000 g16 g15 g14 g13 g12 g11 g10 g9 g8 g7 g6 g5 g4 g3 g2 g1
0000000000000000 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1
These internal R, G, and B words would be shifted, the result masked to 8 bits, and placed in the output word.
-sb -8 gives:
000000000000000000000000 b16 b15 b14 b13 b12 b11 b10 b9
-sg -4 gives:
00000000000000000000 g16 g15 g14 g13 g12 g11 g10 g9 g8 g7 g6 g5
and the result is:
0000000000000000|b16 b15 b14 b13 b12 b11 b10 b9| g12 g11 g10 g9 g8 g7 g6 g5| r8 r7 r6 r5 r4 r3 r2 r1

To swap the bytes of 16 bit pixels in 32 bit words and write 16 bit words:
bdwindow -sr -8 -sg 0 -Ab 0 -w 2 -i in > out

To display 8 or 12 bit pixels (monochrome) shift and replicate the original pixel, then output an rgb triple byte in an int (4 byte word):
top 4 in green top 4, bottom 8 in red.
bdwindow -i wahe.12in12out -sg -4 -Ag 0xF0 -Ab 0 -o tightgenes

Top eight in green, blue; bottom eight in red.
bdwindow -i wahe.12in12out -sg -4 -sb -4 -o tightgenes

Ordinary grayscale image, top 8 (of 12) in all.
bdwindow -i wahe.12in12out -sr -4 -sb -4 -sg -4 -o tightgenes
   

OPTIONS

Options may appear in any order. Later options override previous ones.

-H
The input file is an integer HIPS file. The output HIPS file is byte, short or int, depending on whether ``w'' is 1, 2, 3 or 4.
-s shift
Logical left shift. A negative quantity yields a right shift.
-A andmask
Mask with which to AND the quantity in an input int.
-O ormask
Like AND, but bitwise OR.
-X xormask
Bitwise XOR.
-i input
Read from file input instead of stdin.
-o output
Write to file output instead of stdout.
-w bytesize

Write out a file in something besides ints. Specify number of bytes or bits; -w 1 yields a file of chars, -w 2 a file of short ints, -w 3 a file of 24-bit quantities, and -w 4 long ints (the default). The only acceptable values for number of bits are 8, 16, 24, and 32.

 

AUTHOR

Original Program: Max Rible
Lawrence Berkeley Laboratory, Information and Computing Sciences


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 01:45:31 GMT, December 05, 2024