# Last edited on 2018-06-25 21:02:41 by stolfilocal # Processing images captured by the UFF microscope RENAMING FILES Fetched scans made by Gustavo around 2017-06 from his Google drive https://drive.google.com/drive/folders/0B4RFBC26-_NnbDVvc1c2Q0dzajg Also downloaded the scane made with the v2.0 in 2018-06: https://drive.google.com/drive/folders/1hWlXxL7WprhLK7vBAj09TWOdlJ2XBMp2 Downloaded and unzipped in directory "new". Renamed all files as described below. STOLFI'S NAMING SCHEME The data obtined in one capture session (/scanset/) consists of a set of images of the same object taken in one run, with different illuminations, different focus midplanes (by variable zoom or by moving the camera), and possibly from different viewing directions (by tilting the object and/or tilting and/or displacing the camera). In each directory there may be a file "00-README".. OBJECT DIRECTORIES All the scansets of a given object are in an /object directory/ "objs/{OBJNAME}_{NO}", e.g. "objs/flower_01", where {OBJECT} is a 6-letter descriptive name of the object. {NO} is two digits distinguishing similar objects. SCANSET DIRECTORIES All the files related to each scanset (the captured images and any images or files derived from them) are in a /scanset diretory/ named {OBJDIR}/{YYYY-MM-DD-HHMM} E. g. "objs/flower_01/2017-06-02-0745", where {YYYY-MM-DD-HHMM} is the nominal date and approximate time that the scan was acquired (e.g. of the first image). SCASNSET STRUCTURE The images in the same scanset consist of one or more /image stacks/, where all images in each stach are taken with the same lighting conditions and viewing direction. Each stack is in a /stack directory/ {SCANSET_DIR}/L_{NL}/V_{NV}/ E. g. "objs/flower_01/2017-06-02-0745/L_00/V_00/", where {NL} is two digit identifying the lighting conditions, usually the position of the primary light source, from "00". {NV} is two digits identifying the viewing direction. IMAGE STACK STRUCTURE Within each image stack directory, there may be subdirectories: "raw" - captured images for one object, session, light source, and view. Also some processing of those images prior to alignment. It contains "align" - aligned images obtained with the {hugin} alignment tool (see script {align_images_hugin.sh). "clip_{NC}" - detail images clipped from the "align" images, where {NC} is a two-diigt code distinguishing the region clipped. Within each of these directories, there may be files "frame_{FFFFF}.jpg" - the raw captured image. The sequence number {FFFFF} (five digits, from 00000) is the position of the image in the stack, usually from bottom up. "merge.jpg" - the output of {combine} applied to the raw unaligned images. "work" - subdirectory with various temporary files. RENAMING FILES See the following scripts: new/rename_2017-06-10_dirs.sh new/rename_2017-06-10_files.sh new/rename_2018-06-25_dirs.sh new/rename_2018-06-25_files.sh DISCARDING BAD SETS The following scans were discarded due to bad exposure or other fatal flaws: rm -rf objs/sphere_01/2017-06-07-1436 rm -rf objs/sphere_01/2017-06-07-1510 RUNNING THE ALIGNMENT TOOL Running the {hugin} alignment tool on the raw images: for sub in raw align ; do find objs/ -type d -name "${sub}" -print | sed -e 's:^[.]/::g' -e 's:/'"${sub}"'::g' | sort > .${sub}s uniq -d .${sub}s done bool 1-2 .raws .aligns > .to-align Excluded manually these trivial directories: objs/wpaper_01/2017-05-26-0823/L_00/V_00 objs/wpaper_01/2017-05-26-0823/L_01/V_00 objs/wpaper_01/2017-05-26-0823/L_02/V_00 objs/wpaper_01/2017-05-26-0823/L_03/V_00 objs/wpaper_01/2017-05-26-0823/L_04/V_00 objs/wpaper_01/2017-05-26-0823/L_05/V_00 Aligning the stacks: for dir in `cat .to-align` ; do echo "=== ${dir} ===============================" align_stack_hugin.sh ${dir} raw done Re-aligning the some directories: for led in 0 1 2 3 4 5 ; do dir="objs/flower_01/2017-06-02-0745/L_0${led}/V_00" align_stack_hugin.sh ${dir} raw done Enhancing the contrast of white paper images: for led in 0 1 2 3 4 5 ; do dir="objs/wpaper_01/2017-05-26-0823/L_0${led}/V_00" equalize_raw_images.sh ${dir} done Re-aligning the white paper images: for led in 0 1 2 3 4 5 ; do dir="objs/wpaper_01/2017-05-26-0823/L_0${led}/V_00" align_stack_hugin.sh ${dir} raweq done Dir not work. Converting .tif to .png : for scs in `cat .convs` ; do echo "=== ${scs} ====================================" for file in `cd ${scs} && ls L_*/V_00/align/*.tif` ; do convert ${scs}/${file} -alpha Off ${scs}/${file%.*}.png done ( cd ${scs} && ls -l L_*/V_00/align/*.png ) done Archiving the scansets: for scs in `cat .tars` ; do tar -cvzf ${scs}.tgz ${scs}/L_*/V_00/align/frame_*.png done CLIPPING DETAILS FOR PAPER Clipping some samples for the paper: clip_samples.sh objs/flower_01/2017-06-02-0745/L_05/V_00 '320x121+310+480' '50%' 30