具有中值Filter的Python ITK Rehsape错误

时间:2018-01-31 16:57:33

标签: python arrays numpy scipy itk

我有一个接下来的问题。我有一个大小为91x40x21的浮点数的numpy数组,我想使用中值滤波器。不幸的是,当我试图将它转换回数组时,我得到了这个错误:

"无法将76440大小的数组重塑为形状(0,0,0)"

这是我的代码:

image_view = itk.GetImageViewFromArray(matrix.astype('float32'))
medianImage = itk.MedianImageFilter.New(image_view, Radius = 3)
matrix = itk.GetArrayViewFromImage(medianImage)

1 个答案:

答案 0 :(得分:1)

如果你明确地更新并从图像中获得输出,那么每个思维都会起作用:

 /**
     * Created by trika on 31-Jan-18.
     */
    import React,{Component} from 'react';

    class Modal extends Component{
        constructor(props) {
            super(props);
            this.state = {
                naslov:this.props.naslov,
                telo: this.props.telo
            };
        }

        render(){

            return(
                <div className="modal" id="modal" role="dialog">
                    <div className="modal-dialog" role="document">
                        <div className="modal-content">
                            <div className="modal-header">
                                <h1 className="modal-title"><strong>{this.props.naslov}</strong></h1>
                                <button type="button" className="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>
                            <div className="modal-body">
                                <p>Modal body text goes here.</p>
                                <h2><strong>{this.props.telo}</strong></h2>
                            </div>
                            <div className="modal-footer">
                                <button type="button" className="btn btn-primary">Save changes</button>
                                <button type="button" className="btn btn-secondary" data-dismiss="modal">Close</button>
                            </div>
                        </div>
                    </div>
                </div>
            );
        }
    }

    export default Modal;