Automated Approach of Cataloguing TeraScan Images Utilizing Active Server Pages ONR Multimedia
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Abstract The Center of Excellence in Remote Sensing Education and Research (CERSER) on the campus of Elizabeth City State University is currently tasked with the responsibility of receiving remotely sensed Advanced Very High Resolution Radiometer (AVHRR) and Sea Wide Field-of-View Sensor (SeaWiFS) data for research projects year round. This data is collected, processed, annotated, and transformed into images in the Tagged Image File Format (tiff). These tiff images are then uploaded to the CERSER archive library server located at Once uploaded, they are converted into various resolutions and their information is added to a tracking database maintained with Microsoft Access software. This database provides a searchable means for retrieving satellite image data through various parameters.
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Abstract (cont) The automatic conversion of the original tiff file to various Joint Photographic Experts Group (jpeg) format sizes and the entry of information into the tracking database were completed during this project. Active Server Pages were developed utilizing Visual Basic Scripting, Structured Query Language, and Command Line instructions to the software package ImageMagick™ to complete the tasks. The final file developed was added as a scheduled task to be implemented at a certain time each day on the CERSER platform. This file inventories the “original” folder located on the CERSER server to determine if any files have been uploaded and then processes those that have.
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Introduction - Overview Starting State of CERSER Image Process MMT Tasking
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Introduction - Process Goals Call the ASP page daily ASP Image Conversion Tasks: Convert Date and Satellite information from the file name Open Terascan Database to obtain new file name Write new record to the database Open ImageMagick® Convert/Resize/Rename original image to Actual, Medium, Low, and thumbnail folders Delete original image file
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Active Server Pages Defined Their Use Languages Microsoft Internet Information Services (IIS) Server
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Database - Overview Project Use Defined Rolodex Card System
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Database - Fields Cells that contain actual data TeraScan DB field titles are: ID, Date, Satellite, Product, Description, and Event Field Title > Data Type Selected Examples: Currency, Date & Time, Number, text, etc...
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Database - The Project Select information provided by the image file name: ID, Satellite, and Date Convert this information to the correct format (example: to 03/30/2006) Add a new record for each image
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES ImageMagick ® - Overview Description Formats Supported Actions Available MMT Project Use
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES ImageMagick ® - Command Line Description Input/Output, Text only Punchcards > Command Line > GUI
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks - Overview CERSER Operating System Scheduled Tasks Scheduling the ASP file
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks - Getting Started Opening Task Scheduler
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks – Opening Selecting program to run.
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks - Naming Name scheduled task.
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks - Time & Date Configure day and time.
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks – User Name & Password Enter User Name & Password
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks - Created Completion
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Scheduled Tasks - Modifications Modifying a Task
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code -Pseudocode Defined Example Pseudocode - Display on the screen the variable X VBScript Coding - response.write(x)
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Begin ASP Code <% <!--
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Declare Variables 'Declare Variables dim fs,fo,x, cnvrtDate, imgSat, dbPath, Con, fdb, description, curevent, product, jsfExc PUBLIC lastID Public utilized due to varible use in multiple methods
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Create File System Object 'Set File System Object set fs=Server.CreateObject("Scripting.FileSystemObject") 'Set path to uploaded images folder set fo=fs.GetFolder(server.mappath("\mmt\Pictures\original\")) fs = Instance of FileSystemObject fo = c:\\inetpub\wwwroot\mmt\Pictures\original\
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Begin Image Processing Loop 'BEGIN Loop for files in Original Folder for each x in fo.files fo.files = All the files located in the folder represented by fo fo = c:\\inetpub\wwwroot\mmt\Pictures\original\
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Date Conversion 'START Date conversion cnvrtDate=Mid(x.name,3,2) & "/" & Mid(x.name,5,2) & "/20" & Mid(x.name,1,2) cnvrtDate = reformatted date (YYMMDD to MM/DD/YYYY) Mid(string, start, length) example Mid(CERSER, 3, 2) = “RS”
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Satellite Name Conversion 'START Satellite Conversion if Mid(x.name,13,1)="n" then imgSat = "NOAA-" & Mid(x.name,14,2) End if if Mid(x.name,13,1)="s" then imgSat = "Seawifs-" & Mid(x.name,14,2) End if imgSat = reformatted satellite name (n17 to NOAA-17)
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Set Path to Database 'Set path to Database Set fdb=(fs.GetFolder(server.mappath("/mmt/"))) dbPath = fdb & "\terascan_trial.mdb" server.mappath = c:\\inetpub\wwwroot\ fdb = Path to folder containing the database - c:\\inetpub\wwwroot\mmt\ dbpath = Path to Database - c:\\inetpub\wwwroot\mmt\terascan_trial.mdb
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Open Database 'create connection object, Con is now an instance of ADODB.Connection SET Con = Server.CreateObject( "ADODB.Connection") 'open the database Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath dbpath = Path to Database - c:\\inetpub\wwwroot\mmt\terascan_trial.mdb
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Open Records 'create recordset (rs) object, rs is now an instance of ADODB.recordset set rs=Server.CreateObject("ADODB.recordset") 'Select ONLY the ID column, order it descending using the Con connection rs.Open "SELECT ID FROM Images ORDER BY ID DESC", Con
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Create New ID 'Add one to the ID highest number retrieved and place it in lastID, close connection for each y in rs.fields lastID=y.value +1 next rs.close
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Assign Values 'Assign null or zero values to empty fields description="" curevent="0" product="0"
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Open the “Image” Table 'open the "Images" table in the terascan_trial.mdb rs.Open "Images", Con, 1, 3, 2 rs.open source, connection, CursorTypeEnum, LockTypeEnum, CommandTypeEnum
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Add Values 'Use AddNew method to create the new record rs.AddNew rs("date")= cnvrtdate rs("id")= lastID rs("description")= description rs("event")= curevent rs("product") = product rs("satellite")= imgSat
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Update DB 'Set update to true and confirm update, Update method confirms the update rs.Update 'close the recordset and database connection rs.close Con.close
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Copy/Rename Original 'Copy Original file to Actual Folder and rename using the Copyfile method fs.CopyFile fo & "\" & x.name, fdb & "\Pictures\Actual\" & lastID & ".tiff" fo = c:\\inetpub\wwwroot\mmt\Pictures\original\ fdb = c:\\inetpub\wwwroot\mmt\
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Define New Variables ' Define variables for Image Conversion with ImageMagick Dim WshShell, oExec, CommandLine, imageMagick, orgTiff, desJpg
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Initialize Variables 'Set current position of executable convert.exe imageMagick = "C:\Program Files\ImageMagick Q8\convert.exe" 'Set position of orginal file to be converted orgTiff = fdb & "\Pictures\Actual\" & lastID & ".tiff" fdb = c:\\inetpub\wwwroot\mmt\
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Create Windows Object ' Creating a Windows Shell object in order to access the command line prompt Set WshShell = Server.CreateObject("WScript.Shell")
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Medium Conversion 'Set Destination of Medium Copy, no size change, just type tiff to jpg desJpg = fdb & "\Pictures\Medium\" & lastID & ".jpg" 'Compile arguments into one variable CommandLine = imageMagick & " " & orgTiff & " " & desJpg ' Launching imgmagick Set oExec = WshShell.Exec(CommandLine) fdb = c:\\inetpub\wwwroot\mmt\ imageMagick = c:\Program Files\ImageMagick Q8\convert.exe orgTiff = c:\\inetpub\wwwroot\mmt\Pictures\Actual\lastID.tiff
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES fdb = c:\\inetpub\wwwroot\mmt\ imageMagick = c:\Program Files\ImageMagick Q8\convert.exe orgTiff = c:\\inetpub\wwwroot\mmt\Pictures\Actual\lastID.tiff Code - Low Conversion 'Set Destination of Low Copy, resize 50%, type tiff to jpg desJpg = fdb & "\Pictures\Low\" & lastID & ".jpg" 'Compile arguments into one variable CommandLine = imageMagick & " " & orgTiff & " -resize 50%" & " " & desJpg ' Launching imgmajic Set oExec = WshShell.Exec(CommandLine)
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Thumbnail Conversion 'Set Destination of Thumbnail Copy, resize 15%, type tiff to jpg desJpg = fdb & "\Pictures\Thumbs\" & lastID & ".jpg" 'Compile arguments into one variable CommandLine = imageMagick & " " & orgTiff & " -resize 15%" & " " & desJpg ' Launching imgmajic Set oExec = WshShell.Exec(CommandLine) fdb = c:\\inetpub\wwwroot\mmt\ imageMagick = c:\Program Files\ImageMagick Q8\convert.exe orgTiff = c:\\inetpub\wwwroot\mmt\Pictures\Actual\lastID.tiff
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Free Up Memory 'Free WshShell memory Set WshShell = Nothing Set oExec = Nothing
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Delete Original/End loop 'Delete Original Image fs.DeleteFile(fo & "\" & x.name) next fo = c:\\inetpub\wwwroot\mmt\Pictures\original\
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - Memory/Update Time 'Free fo, fs, and fdb memory set fo=nothing set fs=nothing set fdb=nothing 'Write out the time that the Database was updated response.write("Terascan Database Updated: " & now() & " (Eastern Time)")
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Code - End Comment/ASP --> %>
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Results Trial Code reponse.write() Final Version Folder Permissions
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Results – Update Notification TeraScan Database - New Table ASP Modification
AUTOMATED APPROACH OF CATALOGUING TERASCAN IMAGES UTILIZING ACTIVE SERVER PAGES Future Work Modify Records Notification
Questions