CRIMP
Check-in [cfe5583993]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge trunk documentation updates
Timelines: family | ancestors | descendants | both | infinite-plane
Files: files | file ages | folders
SHA1: cfe5583993a452824956b1e38e7585e60e0e1225
User & Date: andreask 2011-11-18 05:49:12.780
Context
2011-11-19
01:09
Changed the image/volume construction APIss around a bit. API taking location information are now at the core. The old non-location APIs became macros injection their default location (0,0).

Added set of typed constructor taking location information. Updated the warp init code to make use of the new constructors.

Beginning (with float/float) to update the binop core codes to handle mismatched and -aligned images, i.e. of different sizes and translated to each other. Instead of using additional macros for the special cases we reuse the existing one and rely on the compiler to simplify this as much as possible (i.e. constants, irrelevant operations, etc.) check-in: f9955e8a0c user: andreask tags: infinite-plane

2011-11-18
05:49
Merge trunk documentation updates check-in: cfe5583993 user: andreask tags: infinite-plane
05:48
Updated the embedded documentation. check-in: fb38f887d3 user: andreask tags: trunk
02:46
Updated the structure definitions in the documentation, and regenerated the embedded docs. check-in: 6a40a1b540 user: andreask tags: infinite-plane
Changes
Unified Diff Ignore Whitespace Patch
Changes to demos.tcl.
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	    setup       {}
	    setup_image {}
	    shutdown    {}
	}
    }
    set demo_index(A:Unmodified) [list aaaaa N/A]

    foreach f [glob -directory $selfdir/demos *.tcl] {
	set thedemo {}
	source $f
	set name [dict get $thedemo name]
	set demo_label [dict get $thedemo label]
	set demo_index(${demo_label}) [list ${name} [file tail ${f}]]
	#puts <$thedemo>
	set demo($name) $thedemo







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	    setup       {}
	    setup_image {}
	    shutdown    {}
	}
    }
    set demo_index(A:Unmodified) [list aaaaa N/A]

    foreach f [glob -directory [demodir] *.tcl] {
	set thedemo {}
	source $f
	set name [dict get $thedemo name]
	set demo_label [dict get $thedemo label]
	set demo_index(${demo_label}) [list ${name} [file tail ${f}]]
	#puts <$thedemo>
	set demo($name) $thedemo
906
907
908
909
910
911
912










913
914
915
916
917
918
919

proc base {{i 0}} {
    global base
    return [lindex $base $i]
    #return [crimp degamma [lindex $base $i] 2.2]
    #return [crimp gamma [lindex $base $i] 2.2]
}











proc bases {} {
    global base
    return [llength $base]
}

proc thebases {} {







>
>
>
>
>
>
>
>
>
>







906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929

proc base {{i 0}} {
    global base
    return [lindex $base $i]
    #return [crimp degamma [lindex $base $i] 2.2]
    #return [crimp gamma [lindex $base $i] 2.2]
}

proc appdir {} {
    global selfdir
    return $selfdir
}

proc demodir {} {
    global selfdir
    return $selfdir/demos
}

proc bases {} {
    global base
    return [llength $base]
}

proc thebases {} {
Changes to demos/Registration_complete.tcl.
1
2
3
4
5
6
7
8
9
10
11
def op_Registration_complete {
    label {Registration_Complete }
    active {
	expr {[bases] == 1}
    }
    setup_image {
	variable  image1 [base] 
	variable angle 90
	variable scale 0.4
	variable xshift 100
	



|







1
2
3
4
5
6
7
8
9
10
11
def op_Registration_complete {
    label {Registration_Complete }
    active {
	expr {0 && [bases] == 1}
    }
    setup_image {
	variable  image1 [base] 
	variable angle 90
	variable scale 0.4
	variable xshift 100
	
Changes to demos/Registration_rotscale.tcl.
1
2
3
4
5
6
7
8
9
10
11
def op_Registration_rotscale {
    label {Registration_rotscale }
    active {
	expr {[bases] == 1}
    }
    setup_image {
	variable image1 [base] 
	variable angle 90
	variable scale 0.4

	show



|







1
2
3
4
5
6
7
8
9
10
11
def op_Registration_rotscale {
    label {Registration_rotscale }
    active {
	expr {0 && [bases] == 1}
    }
    setup_image {
	variable image1 [base] 
	variable angle 90
	variable scale 0.4

	show
Changes to demos/cut.tcl.
1
2
3
4
5
6
7
8
def cut {
    label {Cut}
    setup_image {
	show_image [crimp cut [base] 50 50 50 50]

	puts [crimp dimensions [crimp cut [base] 50 50 50 50]]
    }
}





|


1
2
3
4
5
6
7
8
def cut {
    label {Cut}
    setup_image {
	show_image [crimp cut [base] 50 50 50 50]

	log [crimp dimensions [crimp cut [base] 50 50 50 50]]
    }
}
Changes to demos/gauss_cleanup.tcl.
1
2
3
4
5

6
7
8
9
10
11
12
def op_gauss_cleanup {
    label {Laplacian of Gaussian Cleanup}
    setup_image {
	show
    }

    setup {
	variable high   200
	variable low    150
	variable sigma1 3.5
	variable sigma2   1

	proc show {args} {





>







1
2
3
4
5
6
7
8
9
10
11
12
13
def op_gauss_cleanup {
    label {Laplacian of Gaussian Cleanup}
    setup_image {
	show
    }
    active {expr 0}
    setup {
	variable high   200
	variable low    150
	variable sigma1 3.5
	variable sigma2   1

	proc show {args} {
Changes to demos/gauss_luma2.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def op_gauss_iir_luma {
    label {Gauss IIR Luma}
    setup {
	variable sigma 0.2
	variable table     {}

	proc show {thesigma} {
	    variable L
	    if {![info exists L]} return
	    set blurred	    [crimp::gaussian_blur_float $L $thesigma]
	    if 0 {		# not needed for blur?
	    set stats	    [crimp::stats_float $blurred]
	    puts stderr "stats: $stats"
	    set offset	    [expr {- [dict get $stats value min]}]
	    set range 	    [expr {[dict get $stats value max] 
				   - [dict get $stats value min]}]
	    set scale	    [expr {255.0 / $range}]
	    set blurred	    [crimp::offset_float $blurred $offset]
	    set blurred     [crimp::scale_float $blurred $scale]
	    }












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def op_gauss_iir_luma {
    label {Gauss IIR Luma}
    setup {
	variable sigma 0.2
	variable table     {}

	proc show {thesigma} {
	    variable L
	    if {![info exists L]} return
	    set blurred	    [crimp::gaussian_blur_float $L $thesigma]
	    if 0 {		# not needed for blur?
	    set stats	    [crimp::stats_float $blurred]
	    log "stats: $stats"
	    set offset	    [expr {- [dict get $stats value min]}]
	    set range 	    [expr {[dict get $stats value max] 
				   - [dict get $stats value min]}]
	    set scale	    [expr {255.0 / $range}]
	    set blurred	    [crimp::offset_float $blurred $offset]
	    set blurred     [crimp::scale_float $blurred $scale]
	    }
Changes to demos/pyramid_blend.tcl.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	variable pleft  [lrange [crimp pyramid laplace $left  $depth] 1 end]
	variable pright [lrange [crimp pyramid laplace $right $depth] 1 end]
	variable pmask  [crimp pyramid gauss   $mask  $depth]

	# Merge the input pyramids into a blend result pyramid.
	variable pblend {}
	foreach a $pleft b $pright m $pmask {
	    #puts "B wXh = [crimp dimensions $a]|[crimp dimensions $b]|[crimp dimensions $m]"
	    lappend pblend [crimp add \
			    [crimp multiply $a $m] \
			    [crimp multiply $b [crimp invert $m]]]
	}

	# At last, fold the pyramid back into a single image, from the
	# bottom up, interpolating the intermediate results to match
	# the next level.

	variable result [lindex $pblend end]
	foreach dog [lreverse [lrange $pblend 0 end-1]] {
	    #puts "+ wXh = [crimp dimensions $dog]|[crimp dimensions $result]"
	    set result [crimp add $dog [crimp interpolate xy $result 2 $ki]]
	}

	show_image $result
	return

	# Slideshow of inputs and intermediate results for debugging...







|











|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	variable pleft  [lrange [crimp pyramid laplace $left  $depth] 1 end]
	variable pright [lrange [crimp pyramid laplace $right $depth] 1 end]
	variable pmask  [crimp pyramid gauss   $mask  $depth]

	# Merge the input pyramids into a blend result pyramid.
	variable pblend {}
	foreach a $pleft b $pright m $pmask {
	    #log "B wXh = [crimp dimensions $a]|[crimp dimensions $b]|[crimp dimensions $m]"
	    lappend pblend [crimp add \
			    [crimp multiply $a $m] \
			    [crimp multiply $b [crimp invert $m]]]
	}

	# At last, fold the pyramid back into a single image, from the
	# bottom up, interpolating the intermediate results to match
	# the next level.

	variable result [lindex $pblend end]
	foreach dog [lreverse [lrange $pblend 0 end-1]] {
	    #log "+ wXh = [crimp dimensions $dog]|[crimp dimensions $result]"
	    set result [crimp add $dog [crimp interpolate xy $result 2 $ki]]
	}

	show_image $result
	return

	# Slideshow of inputs and intermediate results for debugging...
Changes to demos/register_rotscale2.tcl.
1
2
3
4
5
6
7
8
9
10
11
def op_register_rotscale_2 {
    label {Register Images: Rot/Scale, plain}
    active {
	expr {[bases] == 1};	# What's this?
    }
    setup_image {
	show
    }
    setup {
	variable angle 33
	variable scale 1



|







1
2
3
4
5
6
7
8
9
10
11
def op_register_rotscale_2 {
    label {Register Images: Rot/Scale, plain}
    active {
	expr {0 && [bases] == 1}
    }
    setup_image {
	show
    }
    setup {
	variable angle 33
	variable scale 1
Changes to demos/write_pgm.tcl.
1
2
3

4
5
6
def write_pgm {
    label {Write (PGM/plain)}
    setup_image {

	crimp write 2file pgm-plain $dir/written.pgm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_pgm {
    label {Write (PGM/plain)}
    setup_image {
	log "Destination [appdir]/written.pgm"
	crimp write 2file pgm-plain [appdir]/written.pgm [base]
    }
}
Changes to demos/write_pgm_raw.tcl.
1
2
3

4
5
6
def write_pgmraw {
    label {Write (PGM/raw)}
    setup_image {

	crimp write 2file pgm-raw $dir/written.pgm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_pgmraw {
    label {Write (PGM/raw)}
    setup_image {
	log "Destination [appdir]/written.pgm"
	crimp write 2file pgm-raw [appdir]/written.pgm [base]
    }
}
Changes to demos/write_ppm.tcl.
1
2
3

4
5
6
def write_ppm {
    label {Write (PPM/plain)}
    setup_image {

	crimp write 2file ppm-plain $dir/written.ppm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_ppm {
    label {Write (PPM/plain)}
    setup_image {
	log "Destination [appdir]/written.ppm"
	crimp write 2file ppm-plain [appdir]/written.ppm [base]
    }
}
Changes to demos/write_ppm_raw.tcl.
1
2
3

4
5
6
def write_ppmraw {
    label {Write (PPM/raw)}
    setup_image {

	crimp write 2file ppm-raw $dir/written.ppm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_ppmraw {
    label {Write (PPM/raw)}
    setup_image {
	log "Destination [appdir]/written.ppm"
	crimp write 2file ppm-raw [appdir]/written.ppm [base]
    }
}
Changes to doc/crimp_devguide.man.
682
683
684
685
686
687
688




689
690
691
692
693
694
695
696




697
698
699
700
701
702
703
	[enum] [package crimp]
	[enum] [package crimp::tk]
	[enum] [package crimp::bmp]
	[enum] [package crimp::pgm]
	[enum] [package crimp::pfm]
	[enum] [package crimp::ppm]
	[list_end]





    [call [cmd base] [opt [arg N]]]
        Returns the N'th image selected by the user. Counted from 0.
        If not specified 'N' defaults 0.

    [call [cmd bases]]
        Returns the number of selected images. Most useful to the
        'active' script.





    [call [cmd thebases]]
        Returns a list containing all selected images.

    [call [cmd show_image] [arg I]]
        Takes an image I and displays it in the demo result area for
        the user to see.







>
>
>
>








>
>
>
>







682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
	[enum] [package crimp]
	[enum] [package crimp::tk]
	[enum] [package crimp::bmp]
	[enum] [package crimp::pgm]
	[enum] [package crimp::pfm]
	[enum] [package crimp::ppm]
	[list_end]

    [call [cmd appdir]]
        Returns the path of the directory the demo application is
        contained in.

    [call [cmd base] [opt [arg N]]]
        Returns the N'th image selected by the user. Counted from 0.
        If not specified 'N' defaults 0.

    [call [cmd bases]]
        Returns the number of selected images. Most useful to the
        'active' script.

    [call [cmd demodir]]
        Returns the path of the directory the demo's sources are
        contained in.

    [call [cmd thebases]]
        Returns a list containing all selected images.

    [call [cmd show_image] [arg I]]
        Takes an image I and displays it in the demo result area for
        the user to see.
Changes to embedded/man/files/crimp_devguide.n.
241
242
243
244
245
246
247


248
249
250
251


252
253
254
255
256
257
258
..
.TH "crimp_devguide" n 1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_devguide \- CRIMP - The Developer's Guide
.SH SYNOPSIS
\fBcrimp\fR


.sp
\fBbase\fR ?\fIN\fR?
.sp
\fBbases\fR


.sp
\fBthebases\fR
.sp
\fBshow_image\fR \fII\fR
.sp
\fBshow_slides\fR \fILI\fR
.sp







>
>




>
>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
..
.TH "crimp_devguide" n 1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_devguide \- CRIMP - The Developer's Guide
.SH SYNOPSIS
\fBcrimp\fR
.sp
\fBappdir\fR
.sp
\fBbase\fR ?\fIN\fR?
.sp
\fBbases\fR
.sp
\fBdemodir\fR
.sp
\fBthebases\fR
.sp
\fBshow_image\fR \fII\fR
.sp
\fBshow_slides\fR \fILI\fR
.sp
860
861
862
863
864
865
866




867
868
869
870
871
872
873




874
875
876
877
878
879
880
\fBcrimp::pgm\fR
.IP [5]
\fBcrimp::pfm\fR
.IP [6]
\fBcrimp::ppm\fR
.RE
.TP




\fBbase\fR ?\fIN\fR?
Returns the N'th image selected by the user. Counted from 0.
If not specified 'N' defaults 0.
.TP
\fBbases\fR
Returns the number of selected images. Most useful to the
\'active' script.




.TP
\fBthebases\fR
Returns a list containing all selected images.
.TP
\fBshow_image\fR \fII\fR
Takes an image I and displays it in the demo result area for
the user to see.







>
>
>
>







>
>
>
>







864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
\fBcrimp::pgm\fR
.IP [5]
\fBcrimp::pfm\fR
.IP [6]
\fBcrimp::ppm\fR
.RE
.TP
\fBappdir\fR
Returns the path of the directory the demo application is
contained in.
.TP
\fBbase\fR ?\fIN\fR?
Returns the N'th image selected by the user. Counted from 0.
If not specified 'N' defaults 0.
.TP
\fBbases\fR
Returns the number of selected images. Most useful to the
\'active' script.
.TP
\fBdemodir\fR
Returns the path of the directory the demo's sources are
contained in.
.TP
\fBthebases\fR
Returns a list containing all selected images.
.TP
\fBshow_image\fR \fII\fR
Takes an image I and displays it in the demo result area for
the user to see.
Changes to embedded/www/doc/files/crimp_devguide.html.
128
129
130
131
132
133
134
135
136
137


138
139
140
141
142
143
144
145
146
147
148
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="crimp.html">crimp</a></b></a></li>
<li><a href="#2"><b class="cmd">base</b> <span class="opt">?<i class="arg">N</i>?</span></a></li>
<li><a href="#3"><b class="cmd">bases</b></a></li>
<li><a href="#4"><b class="cmd">thebases</b></a></li>


<li><a href="#5"><b class="cmd">show_image</b> <i class="arg">I</i></a></li>
<li><a href="#6"><b class="cmd">show_slides</b> <i class="arg">LI</i></a></li>
<li><a href="#7"><b class="cmd">log</b> <i class="arg">T</i></a></li>
<li><a href="#8"><b class="cmd">log*</b> <i class="arg">T</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Welcome to CRIMP, the C Raster Image Manipulation Package, a set of
extensions of <i class="term">Tcl</i> for the handling and processing of
images.</p>







|
|
|
>
>
|
|
|
|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="crimp.html">crimp</a></b></a></li>
<li><a href="#2"><b class="cmd">appdir</b></a></li>
<li><a href="#3"><b class="cmd">base</b> <span class="opt">?<i class="arg">N</i>?</span></a></li>
<li><a href="#4"><b class="cmd">bases</b></a></li>
<li><a href="#5"><b class="cmd">demodir</b></a></li>
<li><a href="#6"><b class="cmd">thebases</b></a></li>
<li><a href="#7"><b class="cmd">show_image</b> <i class="arg">I</i></a></li>
<li><a href="#8"><b class="cmd">show_slides</b> <i class="arg">LI</i></a></li>
<li><a href="#9"><b class="cmd">log</b> <i class="arg">T</i></a></li>
<li><a href="#10"><b class="cmd">log*</b> <i class="arg">T</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Welcome to CRIMP, the C Raster Image Manipulation Package, a set of
extensions of <i class="term">Tcl</i> for the handling and processing of
images.</p>
604
605
606
607
608
609
610



611
612
613
614
615
616



617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
<li><p><b class="package"><a href="crimp.html">crimp</a></b></p></li>
<li><p><b class="package">crimp::tk</b></p></li>
<li><p><b class="package">crimp::bmp</b></p></li>
<li><p><b class="package">crimp::pgm</b></p></li>
<li><p><b class="package">crimp::pfm</b></p></li>
<li><p><b class="package">crimp::ppm</b></p></li>
</ol></dd>



<dt><a name="2"><b class="cmd">base</b> <span class="opt">?<i class="arg">N</i>?</span></a></dt>
<dd><p>Returns the N'th image selected by the user. Counted from 0.
        If not specified 'N' defaults 0.</p></dd>
<dt><a name="3"><b class="cmd">bases</b></a></dt>
<dd><p>Returns the number of selected images. Most useful to the
        'active' script.</p></dd>



<dt><a name="4"><b class="cmd">thebases</b></a></dt>
<dd><p>Returns a list containing all selected images.</p></dd>
<dt><a name="5"><b class="cmd">show_image</b> <i class="arg">I</i></a></dt>
<dd><p>Takes an image I and displays it in the demo result area for
        the user to see.</p></dd>
<dt><a name="6"><b class="cmd">show_slides</b> <i class="arg">LI</i></a></dt>
<dd><p>Takes a list of images and displays them in the demo result
        area for the user to see, as a slideshow which cycles through
        the images. The user gets a bevy of buttons to start/stop the
        cycling, change cycle interval, and direction.</p></dd>
<dt><a name="7"><b class="cmd">log</b> <i class="arg">T</i></a></dt>
<dd><p>Writes the text T to the demo log window, followed by a newline</p></dd>
<dt><a name="8"><b class="cmd">log*</b> <i class="arg">T</i></a></dt>
<dd><p>Writes the text T to the demo log window. No newline is added
        after the text.</p></dd>
</dl>
</li>
<li><p>The demo framework has a number of hook points in the GUI for use
	by demos. These are:</p>
<ul class="itemized">







>
>
>
|


|


>
>
>
|

|


|




|

|







606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
<li><p><b class="package"><a href="crimp.html">crimp</a></b></p></li>
<li><p><b class="package">crimp::tk</b></p></li>
<li><p><b class="package">crimp::bmp</b></p></li>
<li><p><b class="package">crimp::pgm</b></p></li>
<li><p><b class="package">crimp::pfm</b></p></li>
<li><p><b class="package">crimp::ppm</b></p></li>
</ol></dd>
<dt><a name="2"><b class="cmd">appdir</b></a></dt>
<dd><p>Returns the path of the directory the demo application is
        contained in.</p></dd>
<dt><a name="3"><b class="cmd">base</b> <span class="opt">?<i class="arg">N</i>?</span></a></dt>
<dd><p>Returns the N'th image selected by the user. Counted from 0.
        If not specified 'N' defaults 0.</p></dd>
<dt><a name="4"><b class="cmd">bases</b></a></dt>
<dd><p>Returns the number of selected images. Most useful to the
        'active' script.</p></dd>
<dt><a name="5"><b class="cmd">demodir</b></a></dt>
<dd><p>Returns the path of the directory the demo's sources are
        contained in.</p></dd>
<dt><a name="6"><b class="cmd">thebases</b></a></dt>
<dd><p>Returns a list containing all selected images.</p></dd>
<dt><a name="7"><b class="cmd">show_image</b> <i class="arg">I</i></a></dt>
<dd><p>Takes an image I and displays it in the demo result area for
        the user to see.</p></dd>
<dt><a name="8"><b class="cmd">show_slides</b> <i class="arg">LI</i></a></dt>
<dd><p>Takes a list of images and displays them in the demo result
        area for the user to see, as a slideshow which cycles through
        the images. The user gets a bevy of buttons to start/stop the
        cycling, change cycle interval, and direction.</p></dd>
<dt><a name="9"><b class="cmd">log</b> <i class="arg">T</i></a></dt>
<dd><p>Writes the text T to the demo log window, followed by a newline</p></dd>
<dt><a name="10"><b class="cmd">log*</b> <i class="arg">T</i></a></dt>
<dd><p>Writes the text T to the demo log window. No newline is added
        after the text.</p></dd>
</dl>
</li>
<li><p>The demo framework has a number of hook points in the GUI for use
	by demos. These are:</p>
<ul class="itemized">