<commit_before>#
#   Clip Actor with Spherical Lens
#

# get the interactor ui
source ../../examplesTcl/vtkInt.tcl
source ../../examplesTcl/colors.tcl

proc mkname {a b} {return $a$b}

# proc to make actors
# create pipeline
proc MakeActor { name r g b} {
#
    set filename  [eval mkname $name .vtk]
    set reader  [eval mkname $name PolyDataReader]
    vtkPolyDataReader $reader
       $reader SetFileName $filename
    set mapper [eval mkname $name PolyDataMapper]
    vtkPolyDataMapper $mapper
        $mapper SetInput [$reader GetOutput]
        $mapper ScalarVisibilityOff
        $mapper ImmediateModeRenderingOn
    set actor [ eval mkname $name Actor]
    vtkActor $actor
        $actor SetMapper $mapper
        eval [$actor GetProperty] SetDiffuseColor $r $g $b
        eval [$actor GetProperty] SetSpecularPower 50
        eval [$actor GetProperty] SetSpecular .5
        eval [$actor GetProperty] SetDiffuse .8
    return $actor
}

# Now create the RenderWindow, Renderer and Interactor
#
vtkRenderer ren1
vtkRenderWindow renWin
  renWin AddRenderer ren1
vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

# Add the actors to the renderer, set the background and size
#

ren1 AddActor [eval MakeActor ../../../vtkdata/skin $flesh]

set x 0
set y 70
set z -70
set r 30

#
# make a base plane
#
vtkPlaneSource basePlane
  basePlane SetOrigin -102.4 139.5 -102.4
  basePlane SetPoint1 101.6 139.5 -102.4
  basePlane SetPoint2 -102.4 139.5 101.6
vtkPolyDataMapper baseMapper
  baseMapper SetInput [basePlane GetOutput]
vtkActor base
  base SetMapper baseMapper
ren1 AddActor base

#
# make the geometry for a lens
#
vtkSphereSource lensSource
  lensSource SetRadius $r
  lensSource SetCenter $x $y $z
  lensSource SetThetaResolution 256
  lensSource SetPhiResolution 256

vtkPolyDataMapper lensGeometryMapper
  lensGeometryMapper SetInput [lensSource GetOutput]
  lensGeometryMapper ImmediateModeRenderingOn

vtkActor lensGeometry
  lensGeometry SetMapper lensGeometryMapper
  lensGeometry VisibilityOff

#
# read the volume
#
set RESOLUTION 256
set START_SLICE 1
set END_SLICE 93
set PIXEL_SIZE .8
set origin [expr ( $RESOLUTION / 2.0 ) * $PIXEL_SIZE * -1.0]
set SLICE_ORDER si
source ../../examplesTcl/frog/SliceOrder.tcl

vtkVolume16Reader reader
  eval reader SetDataDimensions $RESOLUTION $RESOLUTION
  eval reader SetFilePrefix ../../../vtkdata/fullHead/headsq
  eval reader SetDataSpacing $PIXEL_SIZE $PIXEL_SIZE 1.5
  eval reader SetDataOrigin $origin $origin 1.5
  eval reader SetImageRange $START_SLICE $END_SLICE
  reader SetTransform si
  reader SetHeaderSize 0
  reader SetDataMask 0x7fff
  reader SwapBytesOn
  reader Update

vtkImplicitVolume aVolumeModel
  aVolumeModel SetVolume [reader GetOutput]
  aVolumeModel SetOutValue 0

#
# clip the lens geometry
#
vtkClipPolyData lensClipper
  lensClipper SetInput [lensSource GetOutput]
  lensClipper SetClipFunction aVolumeModel
  lensClipper SetValue 600.5
  lensClipper GenerateClipScalarsOn
  lensClipper GenerateClippedOutputOff
  lensClipper Update

vtkWindowLevelLookupTable wlLut 
  wlLut SetWindow 1000
  wlLut SetLevel 1200
  wlLut SetTableRange 0 2047<commit_msg>ERR: dataType was not set to LittleEndian as it should have been.<commit_after>#
#   Clip Actor with Spherical Lens
#

# get the interactor ui
source ../../examplesTcl/vtkInt.tcl
source ../../examplesTcl/colors.tcl

proc mkname {a b} {return $a$b}

# proc to make actors
# create pipeline
proc MakeActor { name r g b} {
#
    set filename  [eval mkname $name .vtk]
    set reader  [eval mkname $name PolyDataReader]
    vtkPolyDataReader $reader
       $reader SetFileName $filename
    set mapper [eval mkname $name PolyDataMapper]
    vtkPolyDataMapper $mapper
        $mapper SetInput [$reader GetOutput]
        $mapper ScalarVisibilityOff
        $mapper ImmediateModeRenderingOn
    set actor [ eval mkname $name Actor]
    vtkActor $actor
        $actor SetMapper $mapper
        eval [$actor GetProperty] SetDiffuseColor $r $g $b
        eval [$actor GetProperty] SetSpecularPower 50
        eval [$actor GetProperty] SetSpecular .5
        eval [$actor GetProperty] SetDiffuse .8
    return $actor
}

# Now create the RenderWindow, Renderer and Interactor
#
vtkRenderer ren1
vtkRenderWindow renWin
  renWin AddRenderer ren1
vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

# Add the actors to the renderer, set the background and size
#

ren1 AddActor [eval MakeActor ../../../vtkdata/skin $flesh]

set x 0
set y 70
set z -70
set r 30

#
# make a base plane
#
vtkPlaneSource basePlane
  basePlane SetOrigin -102.4 139.5 -102.4
  basePlane SetPoint1 101.6 139.5 -102.4
  basePlane SetPoint2 -102.4 139.5 101.6
vtkPolyDataMapper baseMapper
  baseMapper SetInput [basePlane GetOutput]
vtkActor base
  base SetMapper baseMapper
ren1 AddActor base

#
# make the geometry for a lens
#
vtkSphereSource lensSource
  lensSource SetRadius $r
  lensSource SetCenter $x $y $z
  lensSource SetThetaResolution 256
  lensSource SetPhiResolution 256

vtkPolyDataMapper lensGeometryMapper
  lensGeometryMapper SetInput [lensSource GetOutput]
  lensGeometryMapper ImmediateModeRenderingOn

vtkActor lensGeometry
  lensGeometry SetMapper lensGeometryMapper
  lensGeometry VisibilityOff

#
# read the volume
#
set RESOLUTION 256
set START_SLICE 1
set END_SLICE 93
set PIXEL_SIZE .8
set origin [expr ( $RESOLUTION / 2.0 ) * $PIXEL_SIZE * -1.0]
set SLICE_ORDER si
source ../../examplesTcl/frog/SliceOrder.tcl

vtkVolume16Reader reader
  eval reader SetDataDimensions $RESOLUTION $RESOLUTION
  eval reader SetFilePrefix ../../../vtkdata/fullHead/headsq
  eval reader SetDataSpacing $PIXEL_SIZE $PIXEL_SIZE 1.5
  eval reader SetDataOrigin $origin $origin 1.5
  eval reader SetImageRange $START_SLICE $END_SLICE
  reader SetTransform si
  reader SetHeaderSize 0
  reader SetDataMask 0x7fff
  reader SetDataByteOrderToLittleEndian
  reader Update

vtkImplicitVolume aVolumeModel
  aVolumeModel SetVolume [reader GetOutput]
  aVolumeModel SetOutValue 0

#
# clip the lens geometry
#
vtkClipPolyData lensClipper
  lensClipper SetInput [lensSource GetOutput]
  lensClipper SetClipFunction aVolumeModel
  lensClipper SetValue 600.5
  lensClipper GenerateClipScalarsOn
  lensClipper GenerateClippedOutputOff
  lensClipper Update

vtkWindowLevelLookupTable wlLut 
  wlLut SetWindow 1000
  wlLut SetLevel 1200
  wlLut SetTableRange 0 2047
{'fraction_non_alphanumeric': 0.05702647657841141, 'fraction_numerical': 0.030393232022559925, 'mean_word_length': 4.030732860520095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4490363', 'n_tokens_mistral': 2203, 'n_tokens_neox': 2019, 'n_words': 672}