[IGSTK-Users] Viewer Problem due to TransformPhysicalPointToIndex

Patrick Cheng cheng at isis.georgetown.edu
Sun Jun 18 22:16:42 EDT 2006


Hi Fucang,

You are very welcome, Thanks for helping us improving the toolkit.

Patrick

Fucang Jia wrote:
> Hi Patrick,
>  
> Thank you for your quickly reply!
>  
> That do solve the problem. I have not tracked into Reslice function and 
> get lost
> in the code.
>  
> Thanks a lot!
>  
> Fucang
>   
> ------------------------------------------------------------------------
> On 2006-06-19 09:56:28 Patrick Cheng
> Subject:    Re: [IGSTK-Users] Viewer Problem due to 
> TransformPhysicalPointToIndex
>  
> Hi  Fucang,
>  
> I  just  looked  into  the  vtkImageActor  class  we  are  using  to 
>  display  the
> image.  The  RequestSetSliceNumber(ContinuousIndexType  index)  function
> of  igstkImageRepresentation  class,  will  send  this  slice  parameters
> down  to  the  vtkImageActor's  SetDisplayExtent(int  extent[6]),  so  there
> is  an  actual  truncation  here.
>  
> I  guess  the  vtkImageActor  is  not  doing  the  interpolation  here. 
>  So  it
> can  only  display  integer  slice  number.  The  jumping  is  caused 
>  by  the
> incorrect  truncation.  We  can  put  a  temp  fix  by  adding  the 
>  following
> lines  into  the  FourViewsTrackingWithCT.cxx  file  after  line  991(after
> we  get  the  continuous  index),
>            index[0]  =  int(  index[0]  +  0.5  );
>            index[1]  =  int(  index[1]  +  0.5  );
>            index[2]  =  int(  index[2]  +  0.5  );
> This  should  fix  the  jumping  problem.
>  
> Let  me  know  if  this  works  for  you,
>  
> Thank  you,
>  
> Patrick
>  
> Fucang  Jia  wrote:
>  >  Hi  Patrick,
>  >    
>  >  I  synchronized  the  IGSTK  and  Sandbox  cvs  and  recompiled  it 
>  from  scratch.
>  >  The  DrawPickedPoint  is  using  continuous  index  now.
>  >    
>  >  But  I  can  reproduce  the  problem  with  the  executable  you 
>  sent  me.  I  just  
>  >  sent
>  >  you  an  animation    to  picture  this  problem.
>  >    
>  >  Thanks  a  lot!
>  >    
>  >  Fucang
>  >    
>  >  ------------------------------------------------------------------------
>  >  On  2006-06-19  02:50:55  Patrick  Cheng
>  >  Subject:        Re:  [IGSTK-Users]  Viewer  Problem  due  to  
>  >  TransformPhysicalPointToIndex
>  >    
>  >  Hi    Fucang,
>  >    
>  >  I    fixed    the    problem    in    the    IGSTK    main   
>  repository,    by    adding
>  >  TransformPhysicalPointToContinuousIndex()    function,    into    the
>  >  igstkImageSpatialObject    class.
>  >    
>  >  But    the    example    application    you    are    running    is 
>    in    the    Sandbox.
>  >    
>  >  You    might    need    to    check    on    two    things:
>  >    
>  >  First,    after    you    update    the    IGSTK    main   
>  repository,    you    have    to  
>  >    CMake
>  >  the    Sandbox    again,    this    way,    the    Sandbox    will   
>  get    the    latest  
>  >    source
>  >  from    main    repository,
>  >    
>  >  Second,    you    have    updated    the    FourViewsTrackingWithCT 
>    application    in
>  >  the    Sandbox.    You    can    double    check    by    looking   
>  into    the
>  >  DrawPickedPoint()    function    in    the   
>  FourViewsTrackingWithCT    .cxx    file.
>  >  See    whether    it's    using    the    continuous    index.
>  >    
>  >  I    will    send    you    the    executables    in    another   
>  separate    email,    because
>  >  this    email    goes    to    the    mailing    list.
>  >    
>  >  Patrick
>  >    
>  >    
>  >    
>  >  Fucang    Jia    wrote:
>  >     >    Hi    Patrick,
>  >     >        
>  >     >    Thank    you    very    much!
>  >     >        
>  >     >    But    I    am    not    keep    clicking    on    the   
>  same    point.    Would    you  
>  >    like    to    share    me    
>  >     >    with
>  >     >    a    Win32    executable    FourViewsTrackingWithCT    app   
>  for    me    to  
>  >    have    a    test?
>  >     >            
>  >     >    Thanks!
>  >     >        
>  >     >    Fucang
>  >     >        
>  >     >   
>  ------------------------------------------------------------------------
>  >     >    On    2006-06-18    06:10:51    Patrick    Cheng
>  >     >    Subject:                Re:    [IGSTK-Users]    Viewer   
>  Problem    due    to    
>  >     >    TransformPhysicalPointToIndex
>  >     >        
>  >     >    Hi        Fucang,
>  >     >        
>  >     >    I        guess        the        problem        is       
>  you        keep        clicking        on  
>  >        the        same        point:    
>  >     >        The        first
>  >     >    time        you        click        on        a       
>  point,        vtk's        z        buffer      
>  >    store        the        value,    
>  >     >        where        the
>  >     >    ray        intersects        with        the        image   
>      plane.        but        NOTICE  
>  >        here,        we        put    
>  >     >        an        sphere
>  >     >    on        that        clicking        point,        if       
>  you        do        not        moving  
>  >        the        mouse,        the    
>  >     >        second
>  >     >    time        you        click        again,        it       
>  actually        will        return      
>  >    the        point        on    
>  >     >        the        sphere
>  >     >    you        have        clicked.        that's        why     
>    the        slice        is      
>  >    still        jumping.        if    
>  >     >        you        move
>  >     >    you        mouse        a        little        bit,       
>  and        click        on        the      
>  >    same        image        plane,        it
>  >     >    shouldn't        have        an        jumping,        i     
>    have        tested        here      
>  >    without        any        problem.
>  >     >        
>  >     >    By        default,        all        the        spatial     
>    object        in        the      
>  >    view        is        pickable        in    
>  >     >        IGSTK.
>  >     >        
>  >     >    Patrick
>  >     >        
>  >     >    Fucang        Jia        wrote:
>  >     >           >                
>  >     >           >        Hi        Patrick,
>  >     >           >                
>  >     >           >        I        found        that        another   
>      vtk        dlls        exists        in  
>  >        the        default        path,    
>  >     >        which        
>  >     >           >        cause        the        fltk        app     
>    can        not        execute,        when
>  >     >           >        I        copy        the        compiled     
>    vtk        dlls        into        the      
>  >    path        of        fltk        app,    
>  >     >        which        works        well.
>  >     >           >                
>  >     >           >        But        on        the        slice       
>  index        jumping        problem,      
>  >    it        seems        that        it    
>  >     >        exists.        If        you        
>  >     >           >        launch        the        app
>  >     >           >        FourViewTrackingWithCT        compiled       
>  in        debug        mode(      
>  >    I        have        not    
>  >     >        tried        in        
>  >     >           >        release        mode),
>  >     >           >        and        load        dataset       
>  IGSTK/Testing/Data/Input/E000192
>  >     >           >        then        let        left        mouse     
>    click        on        the      
>  >    sagittal        view        plane,        you    
>  >     >        will        see        that.        
>  >     >           >        I        first        change        the     
>    sagittal
>  >     >           >        index        to        511,        then     
>    click        once,        the      
>  >    index        is        511,        then        I    
>  >     >        click        it        again,        
>  >     >           >        the        index        changes        to   
>      510.
>  >     >           >        When        I        continue        click   
>      left        mouse        on        it,  
>  >        it        will        change        to    
>  >     >        509,        508,        ...        
>  >     >           >        When        it        change        to       
>  464,        it
>  >     >           >        will        never        change.        When 
>        I        change        the      
>  >    sagittal        slice        to    
>  >     >        another        slice,        
>  >     >           >        then        click,        the        slice   
>      changes
>  >     >           >        again.
>  >     >           >                
>  >     >           >        I        found        this        is       
>  not        due        to      
>  >    TransformPhysicalPointToIndex    
>  >     >        function,        but        
>  >     >           >        in        igstkView.cxx
>  >     >           >                                                     
>                                                  
>  >    m_PointPicker-       >GetPickPosition(        data        );
>  >     >           >        which        compute        z        buffer 
>        depth        from      
>  >    vtkOpenGLRenderWindow.cxx
>  >     >           >        int       
>  vtkOpenGLRenderWindow::GetZbufferData(        int        x1,  
>  >        int        y1,        int    
>  >     >        x2,        int        y2,
>  >     >           >                                                     
>                                                                         
>      
>  >                                                                       
>                                                                            
>  >            
>  >     >                                                                 
>        float*        z_data        )
>  >     >           >                glReadPixels(        x_low,       
>  y_low,
>  >     >           >                                                     
>                                                                         
>      
>  >        width,        height,
>  >     >           >                                                     
>                                                                         
>      
>  >        GL_DEPTH_COMPONENT,        GL_FLOAT,
>  >     >           >                                                     
>                                                                         
>      
>  >        z_data        );
>  >     >           >                
>  >     >           >        I        add        a        line
>  >     >           >                        std::cout       <       
> <"z_data        is        "       <       <*z_data      
>  >   <       <std::endl;
>  >     >           >                
>  >     >           >        when        I        click        the       
>  mouse        at        one        position,  
>  >        the        z_data    
>  >     >        changes.        I        think        this        
>  >     >           >        may        be        the        cause.       
>  But
>  >     >           >        I        can        not        figure       
>  out        why        now.
>  >     >           >                
>  >     >           >        Thanks!
>  >     >           >                
>  >     >           >        Fucang
>  >     >           >                
>  >     >           >                
>  >     >           >      
>  >   
>  ------------------------------------------------------------------------
>  >     >           >        On        2006-06-15        22:55:33       
>  Patrick        Cheng
>  >     >           >        Subject:                                Re: 
>        [IGSTK-Users]        Viewer      
>  >    Problem        due        to        
>  >     >           >        TransformPhysicalPointToIndex
>  >     >           >                
>  >     >           >        Hi                Fucang,
>  >     >           >                
>  >     >           >        1.                You                should 
>                update                both              
>  >    IGSTK                and            
>  >     >        IGSTKSandbox                (bug                fix     
>            is        
>  >     >           >                in                the
>  >     >           >        IGSTK,                I                have 
>                also                changed              
>  >    the                example                app            
>  >     >        in                IGSTKSandbox                to        
>  >     >           >                use                the
>  >     >           >        ContinuousIndex)
>  >     >           >                
>  >     >           >        2.                You                might   
>              need                to              
>  >    cmake                the                IGSTKSandbox            
>  >     >        again,                this                will        
>  >     >           >                take                the
>  >     >           >        latest                code               
>  from                IGSTK                to              
>  >    IGSTKSandbox                build            
>  >     >        directory,                and        
>  >     >           >                then                compile
>  >     >           >        the                IGSTKSandbox.             
>    (You                have                to      
>  >            run                the                cmake            
>  >     >        on                IGSTKSandbox        
>  >     >           >                again,
>  >     >           >        after                you               
>  update                the                IGSTK)
>  >     >           >                
>  >     >           >        I                have                tested 
>                this                on                the  
>  >                same                platform            
>  >     >        here,                it                works             
>    out        
>  >     >           >                fine                here.           
>      If
>  >     >           >        you                still                have 
>                problem                with          
>  >        this.                Can                you                be    
>  >     >                more                specific                on   
>      
>  >     >           >                the                error
>  >     >           >        and                difficulty               
>  you                have                encountered?
>  >     >           >                
>  >     >           >        Patrick
>  >     >           >                
>  >     >           >        Fucang                Jia                wrote:
>  >     >           >                       >                Hi           
>      Patrick,
>  >     >           >                       >                                
>  >     >           >                       >                Thank       
>          you                for                your          
>  >        rapid                reply.
>  >     >           >                       >                                
>  >     >           >                       >                But         
>        after                I              
>  >    synchronized                with                CVS               
>  version,    
>  >     >                I                found                that        
>  >     >           >                all                fltk             
>    app                can                
>  >     >           >                       >                not         
>        run                (                this                app
>  >     >           >                       >                is           
>      compiled                in                debug      
>  >            mode,                VC.Net2003            
>  >     >        fltk-1-1.7                or        
>  >     >           >                fltk-1.1.12-16-05).
>  >     >           >                       >                                
>  >     >           >                       >                Then         
>        I                switched                to          
>  >        VC6                and                compiled               
>  it.    
>  >     >                But                I                found       
>          that        
>  >     >           >                jumping                problem       
>          
>  >     >           >                       >                still       
>          exists.
>  >     >           >                       >                and         
>        m_CTImageObserver-              
>  >     >GetCTImage()-               >IsInside(                p    
>  >     >                )                will        
>  >     >           >                incorrectly                
>  >     >           >                       >                report       
>          to                0                when
>  >     >           >                       >                sagittal     
>            slice                is                0,      
>  >            so                it                will               
>  report    
>  >     >                "Picked                point        
>  >     >           >                outside                image".
>  >     >           >                       >                                
>  >     >           >                       >                Thanks       
>          !
>  >     >           >                       >                                
>  >     >           >                       >                Fucang
>  >     >           >                       >                                
>  >     >           >                       >                             
>                    
>  >     >           >                       >            
>  >     >      
>  >   
>  ------------------------------------------------------------------------
>  >     >           >                       >                On           
>      2006-06-15                01:10:05              
>  >    Patrick                Cheng
>  >     >           >                       >                Subject:     
>                                                            Re:  
>  >                [IGSTK-Users]                Viewer            
>  >     >        Problem                due                to                
>  >     >           >                       >               
>  TransformPhysicalPointToIndex
>  >     >           >                       >                                
>  >     >           >                       >                Hi           
>                      Fucang,
>  >     >           >                       >                                
>  >     >           >                       >                A           
>                      new                            
>  >     >        TransformPhysicalPointToContinuousIndex(p,index)         
>                
>  >     >           >                function                             
>    and                                a
>  >     >           >                       >               
>  ContinuousIndexType                                is              
>  >                    being                                added         
>            
>  >     >                to                                the           
>              
>  >     >           >                ImageSpatialObject's                 
>                API.
>  >     >           >                       >                                
>  >     >           >                       >                Now         
>                        if                                you          
>  >                        take                                the       
>                          pick    
>  >     >                                position                         
>        and                                use                        
>  >     >           >                the                               
>  continuous                
>  >     >           >                       >                             
>    index                                to
>  >     >           >                       >                reslice     
>                            the                              
>  >    image,                                it                           
>      will                            
>  >     >        be                                much                   
>              smoother                        
>  >     >           >                and                               
>  won't                                jump.
>  >     >           >                       >                                
>  >     >           >                       >                Please       
>                          update                              
>  >    your                                IGSTK                         
>        main            
>  >     >                        and                               
>  Sandbox                        
>  >     >           >                repository                           
>      code.
>  >     >           >                       >                                
>  >     >           >                       >                Thank       
>                          you,
>  >     >           >                       >                                
>  >     >           >                       >                Patrick
>  >     >           >                       >                                
>  >     >           >                       >                Fucang       
>                          Jia                                wrote:
>  >     >           >                       >                             
>                   >                                Hi,                  
>  >                Patrick,
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                There              
>  >                    is                                a               
>                  problem                    
>  >     >                due                                to           
>              
>  >     >           >                TransformPhysicalPointToIndex       
>          
>  >     >           >                       >                             
>    function,                                which              
>  >                    
>  >     >           >                       >                             
>                   >                                belongs          
>  >                        to                                Bug#         
>                        738,
>  >     >           >                       >                             
>                   >                                but                  
>  >                it                                seems               
>                  that                            
>  >     >        this                                critial             
>                    bug                                has        
>  >     >           >                                not                 
>                been                                fixed.
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                When                  
>  >                I                                load                 
>        
>  >     >           >               
>  IGSTK\Sandbox-Release-8\Testing\Data\E000192,
>  >     >           >                       >                             
>                   >                                press              
>  >                    the                                left           
>                      mouse            
>  >     >                        button                                on 
>                                the                        
>  >     >           >                sagittal                             
>    view                                in                      
>  >            
>  >     >           >                       >                             
>                   >                              
>  >    FourViewsTrackingWithCT                                app         
>                    
>  >     >        continuously,
>  >     >           >                       >                             
>                   >                                then                  
>  >                the                                index               
>                  changes    
>  >     >                                little                           
>      bye                                one,                        
>  >     >           >                when                               
>  the                                index                          
>  >        of                
>  >     >           >                       >                             
>    sagittal                                viewer              
>  >                    
>  >     >           >                       >                             
>                   >                                was                  
>  >                changed                                to             
>                    0,                            
>  >     >        I                                press                   
>              the
>  >     >           >                       >                             
>                   >                                mouse              
>  >                    button                                onto         
>                        the            
>  >     >                        sagittal                               
>  image,                                it                        
>  >     >           >                says                               
>  "Picked                                point                
>  >     >           >                       >                             
>    outside                                
>  >     >           >                       >                             
>                   >                                image".          
>  >                        I                                tracked       
>                          this    
>  >     >                                bug,
>  >     >           >                       >                             
>                   >                                and                  
>  >                found                                that             
>                    it                            
>  >     >        is                                due                   
>              to                                index              
>  >            
>  >     >           >                round                               
>  up                                problem.
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                For                  
>  >                example,                                the           
>                      origin    
>  >     >                                is                               
>                                  -153.6640625,
>  >     >           >                       >                             
>                   >                                the                  
>  >                spacing                                is             
>                    0.671875
>  >     >           >                       >                             
>                   >                                the                  
>  >                physical                                coordinate     
>                        
>  >     >        is                                16.3203
>  >     >           >                       >                             
>                   >                                so                      
>  >            the                                according               
>                  index    
>  >     >                                is
>  >     >           >                       >                             
>                   >                              
>  >    (16.3203+153.6640625)/0.671875                                =   
>                  
>  >     >                252.9999813953,
>  >     >           >                       >                             
>                   >                                it                      
>  >            was                                truncated               
>                  to                    
>  >     >                252.
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                Then                  
>  >                resliceImage                                function   
>                  
>  >     >                will                                change       
>                          the                        
>  >     >           >                orthogonal                           
>      image                
>  >     >           >                       >                             
>    slice.
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                I                      
>  >            also                                found                 
>                this                            
>  >     >        behaviour                                will           
>                      occur                        
>  >     >           >                when                               
>  certain                                DICOM                
>  >     >           >                       >                             
>    dataset                                is                      
>  >            
>  >     >           >                       >                             
>                   >                                loaded.          
>  >                        When                                I         
>                        load                    
>  >     >                other                                DICOM       
>                          dataset,
>  >     >           >                       >                             
>                   >                                the                  
>  >                axial                                and               
>                  coronal            
>  >     >                        slice                               
>  will                                have                        
>  >     >           >                problem,                             
>    but                                sagittal                
>  >     >           >                       >                             
>    view                                does                                
>  >     >           >                       >                             
>                   >                                not                  
>  >                change                                when             
>                    mouse            
>  >     >                        pressed.                               
>  It                                is                        
>  >     >           >                because
>  >     >           >                       >                             
>                   >                                that                  
>  >                certain                                origin         
>                        and    
>  >     >                                spacing                         
>        parameters                        
>  >     >           >                trigger                             
>    this                                problem.
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                Thanks!
>  >     >           >                       >                             
>                   >                                                     
>            
>  >     >           >                       >                             
>                   >                                Fucang
>  >     >           >                       >                             
>                   >                                
>  >     >           >                       >                             
>                   >                                
>  >     >           >                       >                             
>                   >                        
>  >     >           >            
>  >     >      
>  >   
>  ------------------------------------------------------------------------
>  >     >           >                       >                             
>                   >                                
>  >     >           >                       >                             
>                   >                              
>  >    _______________________________________________
>  >     >           >                       >                             
>                   >                                IGSTK-Users  
>  >                                mailing                               
>  list
>  >     >           >                       >                             
>                   >                              
>  >    IGSTK-Users at public.kitware.com
>  >     >           >                       >                             
>                   >                            
>  >     >       
>  http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>  >     >           >                       >                                
>  >     >           >                
>  >     >        
>  >     >    --        
>  >     >    Patrick        Cheng                                         
>                                                                  
>  >                                                                       
>                                                              
>  >     >        Work        phone:        202-687-2902
>  >     >    Software        Engineer                                     
>                                                              
>  >                                                                       
>                                      
>  >     >        Work        fax:                        202-784-3479
>  >     >    Email:        cheng at isis.georgetown.edu
>  >     >        
>  >     >    Imaging        Science        and        Information       
>  Systems        (ISIS)        Center
>  >     >    Department        of        Radiology,        Georgetown     
>    University      
>  >    Medical        Center
>  >     >    2115        Wisconsin        Avenue,        Suite       
>  603,        Washington,        DC,  
>  >        20007
>  >     >        
>  >    
>  >  --    
>  >  Patrick    Cheng                                                     
>                                                                  
>  >    Work    phone:    202-687-2902
>  >  Software    Engineer                                                 
>                                                      
>  >    Work    fax:            202-784-3479
>  >  Email:    cheng at isis.georgetown.edu
>  >    
>  >  Imaging    Science    and    Information    Systems    (ISIS)    Center
>  >  Department    of    Radiology,    Georgetown    University   
>  Medical    Center
>  >  2115    Wisconsin    Avenue,    Suite    603,    Washington,    DC, 
>    20007
>  >    
>  
> --  
> Patrick  Cheng                                                           
>  Work  phone:  202-687-2902
> Software  Engineer                                                   
>  Work  fax:      202-784-3479
> Email:  cheng at isis.georgetown.edu
>  
> Imaging  Science  and  Information  Systems  (ISIS)  Center
> Department  of  Radiology,  Georgetown  University  Medical  Center
> 2115  Wisconsin  Avenue,  Suite  603,  Washington,  DC,  20007
>  

-- 
Patrick Cheng                              Work phone: 202-687-2902
Software Engineer                          Work fax:   202-784-3479
Email: cheng at isis.georgetown.edu

Imaging Science and Information Systems (ISIS) Center
Department of Radiology, Georgetown University Medical Center
2115 Wisconsin Avenue, Suite 603, Washington, DC, 20007



More information about the IGSTK-Users mailing list