Пример #1
0
        public Image AsPolar(uint innerradius = 0, uint exclusiveouterradius = 0)
        {
            if (IsHalf || IsComplex)
            {
                throw new Exception("Cannot transform fp16 or complex image.");
            }

            if (exclusiveouterradius == 0)
            {
                exclusiveouterradius = (uint)Dims.X / 2;
            }
            exclusiveouterradius = (uint)Math.Min(Dims.X / 2, (int)exclusiveouterradius);
            uint R = exclusiveouterradius - innerradius;

            if (IsFT)
            {
                Image Result = new Image(IntPtr.Zero, new int3((int)R, Dims.Y, Dims.Z));
                GPU.Cart2PolarFFT(GetDevice(Intent.Read), Result.GetDevice(Intent.Write), DimsSlice, innerradius, exclusiveouterradius, (uint)Dims.Z);
                return(Result);
            }
            else
            {
                Image Result = new Image(IntPtr.Zero, new int3((int)R, Dims.Y * 2, Dims.Z));
                GPU.Cart2Polar(GetDevice(Intent.Read), Result.GetDevice(Intent.Write), DimsSlice, innerradius, exclusiveouterradius, (uint)Dims.Z);
                return(Result);
            }
        }