vector < float
>EMData::calc_fourier_shell_correlation(EMData * with) { if (!with) { throw NullPointerException("NULL input image"); } if (!EMUtil::is_same_size(this, with)) { LOGERR("images not same size"); throw ImageFormatException( "images not same size"); } //... } |
void foo() { EMData* e1 = new EMData(); EMData* e2 = new EMData(); try { e1->read_image("test1.mrc"); e2->read_image("test2.mrc"); vector<float> v = e1->calc_fourier_shell_correlation(e2); } catch (E2Exception & exception) { printf("%s\n", exception.what()); } } |
void foo() { EMData* e1 = new EMData(); EMData* e2 = new EMData(); try { e1->read_image("test1.mrc"); e2->read_image("test2.mrc"); vector<float> v = e1->calc_fourier_shell_correlation(e2); } catch (_NullPointerException & exception) { printf("%s\n", exception.what()); } } |
Exception
Name |
Parameters |
Description |
E2Exception |
|
E2Exception class is the parent
class of all EMAN2 E2Exceptions. You may use it to catch any EMAN2
exception. You shouldn't throw any E2Exception in your code. |
FileAccessException | string filename; |
Used when a file access error
occurs. For example, when you try to open a non-existing file or
directory. |
ImageDimensionException | string desc; |
Used when an image is not in the
expected dimension. For example, a 2D image is given when a 3D image is
expected. |
ImageFormatException | string desc; |
Used when an image is not in the
expected format. |
ImageReadException | string imagename; string desc; |
Used when an error occurs at
image reading time. |
ImageWriteException | string imagename; string desc; |
Used when an error occurs at
image writing time. |
InvalidValueException |
int value; int desc; |
Used when an invalid integer
value is given. |
NotExistingObjectException | string objectname; string desc; |
Used when an object type, like
an EMObject type, doesn't exist. |
NullPointerException | string desc; |
Used when a NULL is given to a
pointer that should not be NULL. |
OutofRangeException | int low; int high; int input; int objectname; |
Used when the given value is out
of range. |
TypeException | string desc; string type; |
Used when a type cast error
occurs. For example, when casting an EMData* type to a float type. |
class _NullPointerException : public E2Exception { public: _NullPointerException(const string& file = "unknown", int line = 0, const string& desc_str = "") : E2Exception(file, line, desc_str) {} const char *name() const { return "NullPointerException"; } }; #define NullPointerException(desc) _NullPointerException(__FILE__, __LINE__,desc) |