#include <processor.h>
Inheritance diagram for EMAN::BinarizeFourierProcessor:
Public Member Functions | |
virtual string | get_name () const |
Get the processor's name. | |
virtual void | process_inplace (EMData *image) |
virtual TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
virtual string | get_desc () const |
Get the descrition of this specific processor. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "threshold.binary.fourier" |
Useful in tomography when you want to count large complex pixels. Not the fastest approach, if you were going for efficiency it would probably be better just to iterate through the pixels and count. But if you do it this way you can just get the mean of the resulting image (and multiplying by 2). So it's basically easier, but lazy. Originally added for use by e2tomohunter.py
value | The Fourier amplitude threshold cutoff |
Definition at line 1865 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 1892 of file processor.h. 01893 { 01894 return "f(k) = 0 + 0i if ||f(k)|| < value; f(k) = 1 + 0i if ||f(k)|| >= value."; 01895 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 1868 of file processor.h. 01869 {
01870 return NAME;
01871 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 1885 of file processor.h. References EMAN::TypeDict::put(). 01886 { 01887 TypeDict d; 01888 d.put("value", EMObject::FLOAT, "The Fourier amplitude threshold cutoff" ); 01889 return d; 01890 }
|
|
Definition at line 1872 of file processor.h. 01873 { 01874 return new BinarizeFourierProcessor(); 01875 }
|
|
Implements EMAN::Processor. Definition at line 3771 of file processor.cpp. References binarize_fourier_amp_processor(), EMAN::EMData::get_data(), EMAN::EMData::get_size(), ImageFormatException, InvalidParameterException, EMAN::EMData::is_complex(), EMAN::EMData::ri2ap(), EMAN::Dict::set_default(), EMAN::EMData::set_ri(), EMAN::EMData::update(), and v. 03771 { 03772 ENTERFUNC; 03773 if (!image->is_complex()) throw ImageFormatException("Fourier binary thresholding processor only works for complex images"); 03774 03775 float threshold = params.set_default("value",-1.0f); 03776 if (threshold < 0) throw InvalidParameterException("For fourier amplitude-based thresholding, the threshold must be greater than or equal to 0."); 03777 03778 image->ri2ap(); // works for cuda 03779 03780 #ifdef EMAN2_USING_CUDA 03781 if (image->gpu_operation_preferred()) { 03782 EMDataForCuda tmp = image->get_data_struct_for_cuda(); 03783 binarize_fourier_amp_processor(&tmp,threshold); 03784 image->set_ri(true); // So it can be used for fourier multiplaction, for example 03785 image->gpu_update(); 03786 EXITFUNC; 03787 return; 03788 } 03789 #endif 03790 03791 float* d = image->get_data(); 03792 for( size_t i = 0; i < image->get_size()/2; ++i, d+=2) { 03793 float v = *d; 03794 if ( v >= threshold ) { 03795 *d = 1; 03796 *(d+1) = 0; 03797 } else { 03798 *d = 0; 03799 *(d+1) = 0; 03800 } 03801 } 03802 03803 // No need to run ap2ri, because 1+0i is the same in either notation 03804 image->set_ri(true); // So it can be used for fourier multiplaction, for example 03805 image->update(); 03806 EXITFUNC; 03807 }
|
|
Definition at line 96 of file processor.cpp. |