Skip to content

Commit

Permalink
gui for AutoRemesh
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Rosensteiner committed Aug 17, 2012
1 parent 907b9bb commit 24a3161
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 45 deletions.
Binary file modified AutoRemesh/AutoRemesh.esproj/user.brosensteiner.espressostorage
Binary file not shown.
91 changes: 83 additions & 8 deletions AutoRemesh/AutoRemesh.scro
Expand Up @@ -8,17 +8,92 @@ namespace import -force \
::SharedProcs::*



#set moduleName [string map { "\.scro" "" } $this];# the name of the module

$this proc constructor {} {

# button port
#$this newPortButtonList Utilities 1
#$this Utilities setLabel 0 "Connect all label fields"
#$this Utilities setCmd 0 { $this autoConnectToSurface }
set moduleName [moduleName]
set theAuthor [theAuthor "Bernhard Rosensteiner"]

# button port for Utilities
$this newPortButtonList Utilities 1
$this Utilities setLabel 0 "Connect all surface fields"
$this Utilities setCmd 0 { autoConnectToAll HxSurface }

set theSurfaceRemesher [create HxRemeshSurface]
#$theSurfaceRemesher hide;will be hidden in final version

#recreating the ports of the RemeshSurface module and connecting with it:
$this newPortMultiMenu objective 2
$this objective setLabel 0 0 "High regularity"
$this objective setLabel 0 1 "Best isotropic vertex placement"
$this objective connect $theSurfaceRemesher objective

$this newPortIntTextN triangleArea 3
$this triangleArea setLabel 0 "nPasses"
$this triangleArea setLabel 1 "nAreaSteps"
$this triangleArea setLabel 2 "nEdgeFlips"
$this triangleArea setValues 5 3 3
$this triangleArea connect $theSurfaceRemesher triangleArea

$this newPortIntTextN lloydRelaxation 1
$this lloydRelaxation setLabel 0 "nPasses"
$this lloydRelaxation setValues 40
$this lloydRelaxation connect $theSurfaceRemesher lloydRelaxation

$this newPortIntTextN desiredSize 3
$this desiredSize setLabel 0 "#vert."
$this desiredSize setLabel 1 "#tris"
$this desiredSize setLabel 2 "%"
$this desiredSize setMinMax 2 1 100
$this desiredSize setValues 0 0 100
$this desiredSize connect $theSurfaceRemesher desiredSize

$this newPortButtonList defaults 1
$this defaults setLabel 0 "Set"
$this defaults connect $theSurfaceRemesher defaults

$this newPortIntTextN errorThresholds 2
$this errorThresholds setLabel 0 "smoothness"
$this errorThresholds setLabel 1 "distance"
$this errorThresholds setValues 0 0
$this errorThresholds connect $theSurfaceRemesher errorThresholds

$this newPortFloatTextN densityContrast 1
$this densityContrast setValues 0
$this densityContrast connect $theSurfaceRemesher densityContrast

$this newPortFloatTextN densityRange 2
$this errorThresholds setLabel 0 "min"
$this errorThresholds setLabel 1 "max"
$this errorThresholds setValues 8.58993e+09 8.58993e+09
$this errorThresholds connect $theSurfaceRemesher errorThresholds

$this newPortRadioBox interpolateOrigSurface 2
$this interpolateOrigSurface setLabel "Interpolate orig. surface"
$this interpolateOrigSurface setLabel 0 "smoothly"
$this interpolateOrigSurface setLabel 1 "none"
$this interpolateOrigSurface setValue 1
$this interpolateOrigSurface connect $theSurfaceRemesher interpolateOrigSurface

$this newPortToggleList remeshOptions1 2
$this remeshOptions1 setLabel 0 "fix contours"
$this remeshOptions1 setLabel 1 "contract boundary edges"
$this remeshOptions1 setValue 0 0
$this remeshOptions1 setValue 1 1
$this remeshOptions1 connect $theSurfaceRemesher remeshOptions1

$this newPortRadioBox remeshOptions2 2
$this remeshOptions2 setLabel 0 "whole surface"
$this remeshOptions2 setLabel 1 "only around corners"
$this remeshOptions2 setValue 1
$this remeshOptions2 connect $theSurfaceRemesher remeshOptions2

$this newPortButtonList modifyResult 1
$this modifyResult setLabel 0 "Apply"
$this modifyResult connect $theSurfaceRemesher modifyResult



sayHello
say "hallo es geht alles gut mit dem package loaden"

}

Expand Down
16 changes: 0 additions & 16 deletions AutoRemesh/AutoRemeshProcs.tcl
@@ -1,19 +1,3 @@
# procedure which connects $this to all surface fields in the pool when invoked:
$this proc autoConnectToSurface {} {

set allSurfacesInPoolList [all HxSurface]
set allConPorts [$this connectionPorts]

foreach item $allConPorts {
if { [$this $item isOfType "HxConnection"] } then { $this $item disconnect };#disconnects only HxConnection connection ports (e.g. not colormap port)
}
#(re)connects to all labelfields in pool:
foreach item $allSurfacesInPoolList {
$this [lindex $allEmptyConPorts 0] connect $item
$this compute
}
}

# procedure creates gui elements (separator, bottons, toggles) for a connected lab field \
argument i is the number of portname
$this proc createConPortButtonsToggles { i } {
Expand Down
2 changes: 1 addition & 1 deletion ExtractLabels/ExtractLabels.scro
Expand Up @@ -91,7 +91,7 @@ $this proc constructor {} {
# creates a generic port for some stuff (maybe future extensions):
$this newPortButtonList Utilities 2
$this Utilities setLabel 0 "Connect all label fields"
$this Utilities setCmd 0 { $this autoConnectToLabelField }
$this Utilities setCmd 0 { autoConnectToAll HxUniformLabelField3 }
$this Utilities setLabel 1 "Apply transformation"
$this Utilities setCmd 1 { $this applyTransformation }

Expand Down
Binary file not shown.
20 changes: 1 addition & 19 deletions ExtractLabels/extractLabels.tcl
Expand Up @@ -307,24 +307,6 @@ $this proc makeArrayFromAmiraParameters { field { theComplValArr {} } { concatBu

}


# procedure which connects $this to all label fields in the pool when invoked:
$this proc autoConnectToLabelField {} {

global allConnectedLabFields allEmptyConPorts
set allLabelFieldsInPoolList [all HxUniformLabelField3]
set allConPorts [$this connectionPorts]

foreach item $allConPorts {
if { [$this $item isOfType "HxConnection"] } then { $this $item disconnect };#disconnects only HxConnection connection ports (e.g. not colormap port)
}
#(re)connects to all labelfields in pool:
foreach item $allLabelFieldsInPoolList {
$this [lindex $allEmptyConPorts 0] connect $item
$this compute
}
}

# proc for applying the transformation which $this made -> transformation matrix gets reset, but the object in 3D space stays at its position \
this proc is needed, because when one wants to export for example a HxSurface Object in another application for further processing \
most of the time the amira transformation matrix is not recognized by this applications (except the app can interpret amiramesh files)
Expand Down Expand Up @@ -495,7 +477,7 @@ $this proc createConPortButtonsToggles { i } {
eval "\$this labSetSelBottons\$i setCmd 0 \{ \$this bottonNonePressed " "$i \}"
eval "\$this labSetSelBottons\$i setCmd 1 \{ \$this bottonAllPressed " "$i \}"

# ports should initially hidden:
# ports should initially be hidden:
$this labSeparator$i hide
$this labSetSelBottons$i hide
$this labSet$i hide
Expand Down
2 changes: 1 addition & 1 deletion README.markdown
@@ -1,6 +1,6 @@
# Scripts for Amira

this Amira scipt-object collection is the result of a "little" sideproject of my diploma thesis at the Department of Theoretical Biology at the University of Vienna.
this Amira scipt-object collection is the result of a "little" sideproject of my diploma thesis at the Department of Theoretical Biology at the University of Vienna. For working with Amira script-objects it is advisable to make a local amira directory (look in the online Amira documentation on how to do it).
For convenience there is for every script-object a .rc file for integrating the script-object in the Amira context menu (must be copied in the share/resources folder of $AMIRA\_LOCAL or $AMIRA\_ROOT).
Under some circumstances the .rc file has to be adapted at the hosts environment:

Expand Down

0 comments on commit 24a3161

Please sign in to comment.