How to calculate XYToSlice

hello,i want to know what XYToSlice matrix depends on? the renderer size,image spacing,image dimensions,image origin? anything else? i have seen the 3d slice’s source code ,but i’m confused about fieldofview ,why it init to 250,250,0?and how to recalculate it when the renderer size changed?thank you