SOFTWARE TOOLS FOR IN-SITU DOCUMENTATION OF BUILT HERITAGE

The paper presents open source software tools developed by the author to facilitate in-situ documentation of architectural and archæological heritage. The design choices are exposed and related to a general issue in conservation and documentation: taking decisions about a valuable object under threat. The questions of level of objectivity is central to the three steps of this process. It is our belief that in-situ documentation has to be favoured in this demanding context, full of potential discoveries. The very powerful surveying techniques in rapid development nowadays enhance our vision but often tend to bring back a critical part of the documentation process to the office. The software presented facilitate a direct treatment of the data on the site. Emphasis is given to flexibility, interoperability and simplicity. Key features of the software are listed and illustrated with examples (3D model of Gothic vaults, analysis of the shape of a column, deformation of a wall, direct interaction with AutoCAD).


INTRODUCTION
A set of software tools developed and used by the author in the framework of various documentation projects is presented (Smars et al., 2001, Smars, 2008, Smars and De Jonge, 2009, Smars, 2010, Smars et al., 2012).The purpose of these tools is to facilitate documentation work in-situ, using data acquired using various sensors (total stations, cameras, laser scanners) and hand measurements to produce 3D models (Figures 4,5), analyse geometry and construction technique (Figures 5,6), study and monitor deformations (Figures 1, 6), either interactively, either semiautomatically.
The source code was recently released (Smars, 2013) under a GPL license.
The paper does not describe all the tools.Interested readers will find more detailed information in another paper (Smars, 2010) and in the software documentation.Some features of the software are described and illustrated but the main of the paper is to show how it attempts to fit a specific approach for the documentation of our built heritage.
The choices made for the design of the software tools were guided by a set of principles taken by the author as a credo: • Documentation is never perfectly objective (sections 2 and 3).
• Hybrid approaches, involving a combination of instruments and techniques are most often necessary (section 6).

TRANSPARENCY
We like to believe that our record of a particular object is perfectly faithful to "reality".Of course this is not the case, the result of the documentation process is a measure, the output of some instrument, process, methodology applied to the given object.Results are somehow inaccurate and biased because of the limitations of instruments, techniques but also because of the experience, background and believes of the persons in charge and because of the context of the project.
Documentation as an activity is a step in the path towards the satisfaction of some higher aim: prepare an intervention, assess the importance of a property, measure risks, order emergency actions, understand.
Actions may well be taken without prior documentation.They often are.But that will most likely lead to poor results.Arguably, better, more rational decisions are taken when situations are well understood.Efficiency is one of the virtue of good governance (UNDP, 1997).Documentation reduces uncertainty on the data and consequently facilitates the definition of suitable options, leads to better estimates of their outcome, and globally to a better satisfaction of the objectives.
The whole process is not straightforward though.Given an identical level of knowledge, two deciders will take different decisions, choose different options.Choice is political.This is an unavoidable fact, neither good nor bad.
Documentation professionals are working in this context.Commissions are given and reports are used in the framework of a policy.
It is also a fact that not all the many choices which are made have the same importance.There is a difference between deciding, say, (a) to draw a point somewhere knowing that its position is known with an uncertainty of 5mm  , 1997).That is also the sense of article 16 of the Venice Charter (ICOMOS, 1964).
In that framework, what can be expected from architects, surveyors, engineers, archaeologists working on the documentation of our build heritage?In our opinion, transparency is critical at their level too.It is beneficial to technical operators, deciders and stakeholders to have an unambiguous presentation of the process and of the level of objectivity to be expected from its outcome; basically to identify uncertainty and choices.
Sometimes, decisions can be taken on sounder bases, reducing the uncertainty by allocating sufficient time and money to the documentation process.In other, irreducible choices have to be made, these occurrences should be identified.
These considerations lead us to state the following general recommendations: • Document the process of documenting.From a practical point of view, that means that actions taken on the data have to be remembered, organised, documented.
• Keep the original data (original photographs, points measured by the instruments): traceability.This data is the most basic and "objective".
• Facilitate the possibility to return to some previous stage.
• Advocate the benefits of giving access to this information to the stakeholders: accountability (possibility of peer review, of refuting, inform on the use of public funding).
Many design choices made during the development of the software tools, were made with these ideas in mind: • Keep traces of all the actions on the data (log files, concurrent version systems).
• Use text files: they can be understood by humans, data can be (re-)used easily, even when software becomes obsolete.
• Give a clear view on levels of objectivity, what is data, uncertainty or interpretation.This is further discussed in the next section.
• Offer tools to compare models.
Models are needed to apprehend the infinitely complex reality.They are built in a multidimensional space.Points, lines and other geometrical entities may for instance live in a three dimensional space.Models are manageable because they are finite, bounded.They are defined in a space of finite dimension and by a finite number of numeric parameters.They need to be finite because brains and machines can only process finite sets of data.Because they are finite, they are also approximate.
Models are made in the hope to understand the past and predict the future.
How many parameters are necessary?Three points define a plane, two points a vertical plane.How many points need to be measured to record a wall?A model will need to be chosen.Architects, archaeologists and engineers will probably see and model the wall differently.If the model is just a section, an architect may decide to cut the building at the level of a window.For an engineer, it may be more useful to cut it at the level of a buttress or where the wall is most inclined.For structural analysis, deformations (bulges, traces of relative movements, cracks) will often be important to document.They will affect safety estimates, give clues about the structural history of the structure and record a situation which can be monitored.Are models with many parameters better?Ockham gave us the answer.
One of the key decision is therefore to choose an appropriate model (defined by a finite set of measurable parameters and interpolation and/or extrapolation rules).
The number of parameters will also depend of the number of dimensions considered (or the number and types of fields associated with elements in space and time).Visible line segments have colours.They could be modelled using 12 parameters representing the coordinates and the colour values at its end points (x1, y1, z1, h1, s1, v1) and (x2, y2, z2, h2, s2, v2) and a linear law of interpolation.Other properties: material type, deterioration level, age may be deemed important to document.
Which dimensions need to be documented?That will be another key choice to make.
When a model is defined or chosen, measurements are made."Measurement is the process of assigning numbers to objects or events following rules" (Stevens, 1943).Instruments have rules wired in (take the Disto TM , point it to the object, press the button, read).In some case, this is the easy part.It is rarely difficult to measure the edge of a square or to measure a point with a total station.In other cases, it is more critical: identify stone types, measure a state of deterioration, measure the historical value.In these cases, the interpretative part is more significant.It is particularly important to state clearly the set of rules used to assign tags or numbers.Doing so improve reproducibility but does not necessarily imply consensus.Photographs have often a key role, they can provide a non-interpreted version of a situation.More generally, it is useful to compare models with data and with other models.
Various tools were devised to relate photographs and geometrical models (6.2) and some tools to compare geometrical models (6.1).
It is important to keep in mind that accuracy of a model is not the same as accuracy of the measurements.If it is unlikely to produce accurate models from inaccurate measurements, it is not at all uncommon to have inaccurate models defined by accurate measurements.As discussed above, documentation is a two-times process.During the first qualitative step, the model is chosen (example: the shape is a cube), then in a second quantitative step, a measurements is made (example: the side of the cube is 20 mm).If the shape is not a cube, the model will not be accurate, even if the measurement of one of the edge is excellent.
An ideal set of tools would allow to: • Design or choose models (decide about the number of dimensions and parameters).
• Make measurements to estimate the parameters of the models.
• Measure the quality of the fit (decide about the adequacy of the model, interpret the differences).
• Compare the results with other models.
• Offer tools to improve models (refine their geometry, add new dimensions) Operations do not have to occur in that sequence.It is also a potentially never ending process.Data can be explored to get hints about suitable models.The large quantity of data acquired by laser scanners make this approach easier today (Figure 1).In that perspective, laser scanners are rather data providers than model providers.Models produce but also require understanding and understanding requires time, reduction of the number of parameters, categorisations.The current excitement around laser scanners and their extraordinary possibilities often lead people to forget that it takes time and human brains to turn data into knowledge.
Figure 1: Analysis of the deformation of a wall, Baalbek, Lebanon.Horizontal deformations are magnified 10 times.Interactive analysis of a data set, trying to understand and model the deformation.
The features list for a set of tools presented above was qualified "ideal" because it is still a vision for the future or a programme.It is certainly not yet fully implemented.The possibility to easily define flexible models and to fit them to measurements in-situ is a very complex matter.

IN-SITU MEASUREMENTS
In the author understanding, Conservation of Built Heritage is deemed necessary because: • Values are attributed to an object (historical, artistic, economical, etc) • Values are under threat (development, disasters, ageing, oblivion, etc).
Documentation has a key clearly a role in "measuring" both values and threats.
Conservation actions try to find an optimum balance between statu-quo (conservation of the values) and changes (mitigation of the threat).In a society, actions are actually decided in a larger perspective, which includes considerations about management, development, tourism, sustainability, creation of values and many other aspects that introduce new terms in the equation (the "Strategic Programme Objectives" of UNESCO are very clear in that respect).The issue is political (in a noble sense, related to choices): what place is given in our society to Cultural Heritage?An instrument of development?A window on our past?Something to design?According to the CIPA charter, recording is "one of the principal ways to give meaning, understanding, definition and recognition of the values of the cultural heritage" (ICOMOS, 1996).This is probably a good technical definition which can satisfy tenants of opposite opinions about the meaning of our built heritage.
The emphasis for in-situ measurements is political in that sense: learn from the past (from an existing object), rather than design for the future (or for the least, contribute to the identification of the associated values).Historical values (Art history, technological history, traces of events) are often associated with rarity and rarity certainly commands caution.There is a high risk to use common frame of thoughts to approach an object which by definition is different.If we care about these values, and want to maximise the chance to identify them before deciding about their fate, it is critical to compare our models with the artefact.It is important to have the possibility to compare, refine, approach, refute, interrogate, i.e. to work on the site (nothing new for an archaeologist or a scientist).
The quality of the decisions affecting our built heritage depends of the quality of of the measure of values and threats.If we care about historical values, in-situ measurements is the way to go.
The tools developed try to facilitate the treatment of the data acquired with total stations, laser scanners, photographs on the site.They include tools to control the instruments, to visualise the data, to integrate data coming from different sources, to build models, to compare them.This is a work in progress, new experiences introduce new needs.

SOFTWARE TOOLS DESIGN
The documentation process typically involves a large number of actions.Data is acquired, using a variety of sensors (total stations, cameras, laser scanners, gps -tape measures).It is then processed, organised, interpreted.The objective is to bring meaning to the object under investigation, to create knowledge.Actions are related to each other by a -sometime complex -network of relations (Figure 2).This pattern is certainly not specific to the documentation process.
The design of the tools presented was inspired by the Unix philosophy (Raymond, 2003), a loose set of principles or rules drawn to improve the efficiency of similar "information" processes, offering flexibility and power to both users and developers.Among the principles followed, we can mention: modularity, simplicity, clear interfaces, easy connections, use of text files.The OS used to develop and test the tools are FreeBSD and Linux (many of them would also work under windows).
Most programs are small.They achieve one or a very limited number of tasks.That makes them easy to understand and to maintain.The more they are used, the more robust they become.Many of them are filters: they take some input data and produce an output.A simple filter is for instance used to translate geometries (point clouds, lines).Input and output can be files but can also, as it is common in Unix, go through pipelines of commands like.Other tools are designed as Tcl libraries.Tcl is a general purpose scripting language which makes it easy to "glue" programs, instruments or computers together to achieve complex tasks and, with its extension Tk, to create graphical user interfaces.The new Tcl libraries define objects (geometrical elements like points or circles, 3D visualisation windows, system of units) and allow to manipulate them (move, compute shortest distances, surface, export to files).
Programs, libraries and scripts are developed in C++, Tcl/Tk and shell scripts.Whenever possible, existing libraries are used, chiefly VTK (Kitware, 2013b) for the visualisation and VxL (VxL, The Vision-Something-Libraries, C++ Libraries for Computer Vision Research and Implementation, 2013) for photogrammetric computations and optimisation.

DATA ACQUISITION
All surveying techniques have limitations.Even if, in theory, they can provide a complete and everywhere accurate set of measurements, this is rarely the case in practice.
Hand measurements are often difficult because of accessibility problems (high facades, roofs, vaults) but they are still efficient to survey smaller architectural elements like doors, windows or mouldings for instance.Even if they produce data at a slower path, they somehow imply a parallel progression of data acquisition and understanding.
Total stations, laser scanners and photogrammetry have also their limitations.The first one is related to the completeness of the data set.Only the parts of the object visible from the station of the instrument can be measured.Many architectural elements are designed to produce shadows which contribute to the character of the work.A complete survey of their geometry would often require an impractical number of stations.Capitals, pediments and mouldings are particularly difficult elements to measure.Another limitation is related to the sampling process.Laser scanners, like CD recorders, attempt to produce an image of a continuous process.But there is no such thing as continuous recordings.Documentation is always a process of discretisation.As it is well known from the Nyquist-Shannon sampling theorem, the highest frequency that can be recorded depends of the sampling rate.This is true in time and in space.Laser scanner measure points, they often fail to record accurately edges and fine details.If automatic processes are used to produce surfaces from the point measurements, there is also a risk of aliasing.Dealing with electric signals, it is customary to pass the data though filters before sampling to eliminate non interesting frequencies (above the limits of perception), avoid aliasing and moire patterns.This is not often practical with laser scanners.In theory, these limitations can be overcome: increasing resolution and number of stations.In practice, it is often more efficient (in time, resources and money) and interesting to consider that these techniques provide data (measurements) rather than models (section 3).Other techniques, and work in situ can help understanding the object and finalising the process of models construction.
The approach here advocated is designed with the idea that it is not possible to decide in abstracto which technique and approach will be the most efficient.It is therefore better to provide a flexible framework which can easily integrate data coming from various sources.

Total Station / Laser Scanner
The use of a total station to measure masonry vaults is at the origin of many of the tools developed.To model the surface of the web of a vault (an object of great interest to the author), numerous points have to be measured (typically a few thousands).It is sometimes difficult to identify the main characteristics of the geometry before actually measuring it.It is also difficult not to forget some areas.Tools were developed to allow a real-time control of the measurements (Figure 3).A module control the total station from a computer (in Tcl/Tk) using the serial port (possibly via Bluetooth or wifi).Measurements can be triggered from the instrument or from the computer.
Data is typically sent to a visualisation module where points are seen in 3D.The module offers various function to navigate the data, organise it in layers, export it to various formats, import reference data.All actions are recorded in log files.Measurement and visualisation modules are independent, data is exchanged via network sockets.This system allows a greater flexibility.Rough measurements can be sent in parallel to another location, to a log file, to some processing tool, to another computer.
The module controlling the total station allows choosing the type of measurement.We commonly use points, lines and rays.Points are also used to measure surfaces.It is possible to create surfaces directly but to see the points in the 3D windows actually gives a clearer feedback.External tools were developed to create triangular meshes from point clouds (and also to manipulate point clouds and triangle files).Rays are line segments starting from the instrument and going to the point measured by the total station.They are useful to measure edges for which total stations often fail to return the exact distance.They materialise the angle measured (one or two points close to the edge can then be measured to get a good estimate of the distance).
In some cases, it can be useful to send the data to a CAD program like AutoCAD.This does not allow to navigate through the 3D data as fast as with the visualisation module but it provides a richer set of commands.To work on the model of Figure 4, the total station was connected to a small laptop computer running the software to control the total station and a visualisation window to give a direct feedback to the operator.In parallel, the data was sent to another computer set on a table where a collaborator was using AutoCAD.When ready, he requested new measurements from a buffer running on his computer.Some fine details like mouldings, were measured by hand, others using photographs (next sub-section).
We often use the word 'can'.The point is that the process is meant to be flexible.In some circumstances, it make sense to organise a complex setup.In others, just one or two tools can be used.The possibility of real-time control actually often result in a faster setting of the instruments.Complex and repetitive setups can also be prepared in advance and launched with a few clicks .
Tcl/Tk makes it easy to "glue" programs and prepare user interfaces.
In line with the discussion made on models (section 3), programs were developed to fit measurements (point clouds) and models: find robust fit to a specific shape (line, plane, circle, sphere, cylinder, cone) or model rib-like elements.A future line of development will be to try to offer tools to fit more complex parametric models to measured data.
Most of these tools can be used (and were used) with laser scanner data (Figures 1, 6).

Camera
Photographs carry a lot of information.They are fast, cheap and relatively objective.They record dimensions invisible to total stations or other instruments: colours, shades, deterioration.They can also be used to extract geometrical information and to validate models.
Tools were developed to control cameras from a computer [using gphoto (Gphoto, digital camera software, 2013) and Tcl/Tk], correct the radial distortions, calibrate cameras, extract exif data.In a typical setup, a photograph is taken, the distortions corrected and the image is sent to a visualisation module where points can be marked on the 2D image and from which the total station can be triggered to measure the 3D position of the point.Using, this data, the position and orientation of the camera is computed.This data can then be used to "wrap" the photograph on a 3D model (Figure 5), to project model features on the photograph (useful to control the model) Figure 5: Projection of a photograph on the 3D model of a vault, section through the model to draw isolines.Humelghem, Belgium.
Alternatively, images can be processed (automatically or manually) using Gimp (GIMP, GNU Image Manipulation Program, 2013), Photoshop or other common software programs to prepare interpretative images (materials, deterioration, historical phases).In this way, the idea is not to produce a unique, static 3D model but rather to produce information from data sources which can be combined or compared in various ways.
Simpler programs were also prepared to compute and prepare homographies which are fast and efficient to measure plane objects.
Presentation documents (say a 1/20 facade detail) can be prepared using scripts, which assemble pieces of geometrical data (possibly moving, rotating or cutting it), project images or colour the model according to some measurements.These possibilities were used to study the structural pathology of construction in the archaeological site of Baalbek (Smars et al., 2012, Smars, 2012).The geometrical data was acquired by a laser scanner (Van Genechten et al., 2011).The use of scripts makes the preparation of new documents from new laser scanner measurements trivial, making a monitoring of the deformations easy (Figure 6).

CONCLUSIONS AND FUTURE WORK
Many tools presented in the paper exist in some other form elsewhere (Latimer CAD, 2013, MeshLab, 2013, Kitware, 2013a, Panotools, 2013, Itseez, 2013).Given the space limitations, a review of them is not included.What is specific in the approach is the aim: to provide an open and efficient framework for the in-situ documentation of built heritage.Some of the key features are: open source code, ease of use in-situ, flexibility.
This is a work in progress.Changes and improvements occur as new needs arise.Some tools have been extensively used and are now stable and robust, others are still experimental and need more testing.Collaboration is welcome.The approach advocated is not yet fully effective.In practice, there are still bottlenecks, missing pieces, especially when dealing with new situations.It is not yet always possible to do as much work as we would like on the site.This is often due to logistics: time, infrastructure (sometimes trivial matters like table, umbrellas) and personnel are critical in practice.More attention is currently paid about the documentation of the various tools to encourage the use of the tools by new users.
In well-tested scenarios, like the measurement of vaults (Smars and De Jonge, 2009) or the documentation of structural pathology (Smars, 2012), the workflow is now smooth and fast.

Figure 3 :
Figure 3: Real-time control of the total station measurements.

Figure 6 :
Figure 6: Analysis of the shape of a column of the temple of Jupiter, Baalbek, Lebanon.