! @brief This function reads one of the image blobs @param [in] image 1 of 3 projects or the visual @param [out] imageType identifies the image format desired. @param [out] imageWidth The image width (in pixels). @param [out] imageHeight The image height (in pixels). @param [out] imageSize This is the total number of bytes for the image blob. @param [out] imageMaskType This i
| 98 | @return Returns true if successful |
| 99 | */ |
| 100 | static bool _getImage2DNodeSizes( const StructureNode &image, Image2DType &imageType, |
| 101 | int64_t &imageWidth, int64_t &imageHeight, int64_t &imageSize, |
| 102 | Image2DType &imageMaskType ) |
| 103 | { |
| 104 | imageWidth = 0; |
| 105 | imageHeight = 0; |
| 106 | imageSize = 0; |
| 107 | imageType = ImageNone; |
| 108 | imageMaskType = ImageNone; |
| 109 | |
| 110 | if ( image.isDefined( "imageWidth" ) ) |
| 111 | { |
| 112 | imageWidth = IntegerNode( image.get( "imageWidth" ) ).value(); |
| 113 | } |
| 114 | else |
| 115 | { |
| 116 | return false; |
| 117 | } |
| 118 | |
| 119 | if ( image.isDefined( "imageHeight" ) ) |
| 120 | { |
| 121 | imageHeight = IntegerNode( image.get( "imageHeight" ) ).value(); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | return false; |
| 126 | } |
| 127 | |
| 128 | if ( image.isDefined( "jpegImage" ) ) |
| 129 | { |
| 130 | imageSize = BlobNode( image.get( "jpegImage" ) ).byteCount(); |
| 131 | imageType = ImageJPEG; |
| 132 | } |
| 133 | else if ( image.isDefined( "pngImage" ) ) |
| 134 | { |
| 135 | imageSize = BlobNode( image.get( "pngImage" ) ).byteCount(); |
| 136 | imageType = ImagePNG; |
| 137 | } |
| 138 | |
| 139 | if ( image.isDefined( "imageMask" ) ) |
| 140 | { |
| 141 | if ( imageType == ImageNone ) |
| 142 | { |
| 143 | imageSize = BlobNode( image.get( "imageMask" ) ).byteCount(); |
| 144 | imageType = ImageMaskPNG; |
| 145 | } |
| 146 | |
| 147 | imageMaskType = ImageMaskPNG; |
| 148 | } |
| 149 | |
| 150 | return true; |
| 151 | } |
| 152 | |
| 153 | /// Possibly get min/max from the colour node itself instead of the colorLimits. |
| 154 | void _readColourRanges( const std::string &protoName, const StructureNode &proto, |
no test coverage detected