how to add a set of images?

Charles Law charles.law at kitware.com
Mon Apr 24 11:26:37 EDT 2000


At 05:12 AM 4/24/00 -0400, you wrote:
> >>>>> "cl" == Charles Law <charles.law at kitware.com> writes:
>
>     cl> There are multiple ways you can do this.  In the nightly
>     cl> release, vtkDataObjects have ShallowCopy and DeepCopy.
>
>     cl> The following should work.  See the changes below.
>
>Great. Thanks.  It doesn't work with ShallowCopy but it does with
>DeepCopy.
>
>Would you happen to know a way to do this using vtk 3.1, not the
>nightly release?
>--



Sure,  here is another:


>vtkImageMathematics add
>add SetOperationToAdd
>
>vtkImageReader reader
>reader SetFilePrefix [lindex $series 0]

reader Update
set last  [reader GetOutput]
vtkImageData d0
reader SetOutput d0

>foreach i [lrange $series 1 end] {

       add SetInput1 $last

>     reader SetFilePrefix $i;
>     add SetInput2 [reader GetOutput]

        add Update
        set last [add GetOutput]
        vtkImageData d$i
        add SetOutput d$i
}


That should work ...  or try this:

vtkImageReader reader0
   reader0 SetFilePrefix [lindex $series 0]

set last [reader0 GetOutput]

>foreach i [lrange $series 1 end] {
>         vtkImageReader reader$i
>         reader$i SetFilePrefix [lindex $series i]
>         vtkImageMathematics add$i
>         add$i SetOperationToAdd
         add$i SetInput1 $last
         add$i SetInput2 [reader$i GetOutput]

         set last [add$i GetOutput]
}

add$end Update




--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list