Index: trunk/magic/remove/src/streaksextern.c
===================================================================
--- trunk/magic/remove/src/streaksextern.c	(revision 20281)
+++ trunk/magic/remove/src/streaksextern.c	(revision 20281)
@@ -0,0 +1,99 @@
+/* Standard includes */
+
+#include <stdio.h>
+
+/* psLib includes */
+
+#include "psMemory.h"
+
+/* streakremove includes */
+
+#include "streaksextern.h"
+#include "Line.h"
+
+/** Create a list of pixel positions from a Streaks pointer list
+    converting the equatorial coordinates into the pixel coordinates
+    using strkAstrom and building streak pixels using the specified
+    width and store in StreakPixels object returned
+
+    @param[in] streaks List of streak pointer objects to convert to
+                       pixel positions output in StreakPixels
+    @param[in] astrom Astrometry object for converting streak equatorial
+                      coordinates into pixel positions
+    @param[in] numCols number of columns in the image to map streak equatorial
+                       coordinates into pixel positions
+    @param[in] numRows number of rows in the image to map streak equatorial
+                       coordinates into pixel positions
+    @return list of PixelPos pointers for the streaks mapped to the image
+            pixels
+*/
+    
+StreakPixels *streak_on_component(Streaks *streaks, strkAstrom *astrom,
+                                  int numCols, int numRows)
+{
+    int i;
+    Line line;
+    StreakPixels *pixels = psArrayAllocEmpty (1024);
+    for (i = 0; i != streaks->size; ++i)
+    {
+        /* Convert streak equatorial coordinates into pixel based line */
+
+        line.width = streaks->list[i].width;
+        if (skyToCell (&line.begin, astrom,
+                       streaks->list[i].ra1, streaks->list[i].dec1) &&
+            skyToCell (&line.end, astrom,
+                       streaks->list[i].ra2, streaks->list[i].dec2) &&
+            LineClip (&line, numCols, numRows))
+        {
+            PixelsFromLine (pixels, &line);
+        }
+    }
+    return pixels;
+}
+
+/** Read a list of streak equatorial coordinate definitions and width
+    from a text file.  The format is:
+
+    @verbatim
+    numStreaks
+    ra1 dec1 ra2 dec2 width
+    ...
+    @endverbatim
+
+    @param[in] fileName path to streak text file to read
+    @return a list of streak objects.  If there is an error in reading
+            the text file, return NULL
+*/
+
+Streaks *readStreaksFile(char *fileName)
+{
+    int i;
+    Streaks *streaks = NULL;
+    FILE *file = fopen (fileName, "r");
+    if (file != NULL)
+    {
+        streaks = psAlloc (sizeof(Streaks));
+        if (fscanf (file, "%u", &streaks->size) != 1)
+        {
+            psFree (streaks);
+            fclose (file);
+            return NULL;
+        }
+        streaks->list = psAlloc (streaks->size * sizeof(streak));
+        for (i = 0; i != streaks->size; ++i)
+        {
+            if (fscanf (file, "%f %f %f %f %f",
+                        &streaks->list[i].ra1, &streaks->list[i].dec1,
+                        &streaks->list[i].ra2, &streaks->list[i].dec2,
+                        &streaks->list[i].width) != 5)
+            {
+                psFree (streaks->list);
+                psFree (streaks);
+                streaks = NULL;
+                break;
+            }
+        }
+        fclose (file);
+    }
+    return streaks;
+}
Index: trunk/magic/remove/src/streaksextern.h
===================================================================
--- trunk/magic/remove/src/streaksextern.h	(revision 20281)
+++ trunk/magic/remove/src/streaksextern.h	(revision 20281)
@@ -0,0 +1,76 @@
+#ifndef STREAKSEXTERN_H
+#define STREAKSEXTERN_H
+
+/** psLib includes */
+
+#include "psArray.h"
+
+/** streakremove includes */
+
+#include "streaksastrom.h"
+
+/** Equatorial coordinates of streak endpoints in radians */
+
+typedef struct {
+    double ra1;
+    double dec1;
+    double ra2;
+    double dec2;
+    double width;   /**< Width of streak in pixels */
+} streak;
+
+/** List of streak objects to map to image pixel positions */
+
+typedef struct {
+    unsigned int size;
+    streak *list;
+} Streaks;
+
+/** Pixel position within an image */
+
+typedef struct {
+    unsigned int x; /**< X (column) pixel position */
+    unsigned int y; /**< Y (row) pixel position */
+} PixelPos;
+
+/** For now, use psArray to define a list of PixelPos pointers */
+
+typedef psArray StreakPixels;
+typedef psArray imageStreak;
+
+/** Create a list of pixel positions from a Streaks pointer list
+    converting the equatorial coordinates into the pixel coordinates
+    using strkAstrom and building streak pixels using the specified
+    width and store in StreakPixels object returned
+
+    @param[in] streaks List of streak pointer objects to convert to
+                       pixel positions output in StreakPixels
+    @param[in] astrom Astrometry object for converting streak equatorial
+                      coordinates into pixel positions
+    @param[in] numCols number of columns in the image to map streak equatorial
+                       coordinates into pixel positions
+    @param[in] numRows number of rows in the image to map streak equatorial
+                       coordinates into pixel positions
+    @return list of PixelPos pointers for the streaks mapped to the image
+            pixels
+*/
+    
+extern StreakPixels *streak_on_component(Streaks *streaks, strkAstrom *astrom,
+                                         int numCols, int numRows);
+
+/** Read a list of streak equatorial coordinate definitions and width
+    from a text file.  The format is:
+
+    @verbatim
+    numStreaks
+    ra1 dec1 ra2 dec2 width
+    @endverbatim
+
+    @param[in] fileName path to streak text file to read
+    @return a list of streak objects.  If there is an error in reading
+            the text file, return NULL
+*/
+
+extern Streaks *readStreaksFile(char *fileName);
+
+#endif /* STREAKSEXTERN_H */
