1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 <2020> 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 <2020> 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: Getting images from area detector plugins |
From: | Mark Rivers via Tech-talk <tech-talk at aps.anl.gov> |
To: | 'Randall Cayford' <rcayford at lbl.gov> |
Cc: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Fri, 24 Jan 2020 23:17:53 +0000 |
Hi Randall, I just verified that the ArrayData waveform record indeed contains a valid JPEG image. I executed the following IDL commands, which read the waveform record via Channel
Access and write it to a file called test.jpg. IDL> t = caget('13SIM1:image1:ArrayData', v, max=100000L) IDL> openw, 1, 'test.jpg' IDL> writeu, 1, v IDL> close, 1 I then double-clicked on that test.jpg file and it opened in Windows Photos fine. I also dragged it into ImageJ and it opened fine. Note that I had to tell caget() how many bytes to read (100000), which I specified manually just for this test. It is actually about 50% larger than the actual JPEG data,
so the file is larger than it needs to be. That information is available over Channel Access from the CompressedSize_RBV PV. CompressedSize is guaranteed to update before the ArrayData does, but the application needs to be fast enough so that the size it
use for a read request applies to the next waveform update, because with compression the size is constantly changing. Using PVA is much cleaner because the NTNDArray is atomic, the size is always correct. Mark From: Tech-talk <[email protected]> On Behalf Of
Mark Rivers via Tech-talk Hi Randall, I have made the required changes to NDPluginStdArrays so that compressed NDArray data can be transmitted over Channel Access in $(P)$(R)ArrayData. I just tested with ADSimDetector which was generating 1024x1024 UInt8 images at 10 Hz. NDPluginCodec was configured to compress with JPEG, 85% quality factor. NDPluginStdArrays
was getting its data from NDPluginCodec. This is the result of camonitor of the first 500 elements in 13SIM:image1:ArrayData. These are the first 3 arrays. corvette:~/devel/areaDetector/ADCore>camonitor -#500 13SIM1:image1:ArrayData 13SIM1:image1:ArrayData 2020-01-24 16:16:12.255831 500 -1 -40 -1 -32 0 16 74 70 73 70 0 1 1 0 0 1 0 1 0 0 -1 -37 0 67 0 5 3 4 4 4 3 5 4 4 4 5 5 5 6 7 12 8 7 7 7 7 15 11 11 9
12 17 15 18 18 17 15 17 17 19 22 28 23 19 20 26 21 17 17 24 33 24 26 29 29 31 31 31 19 23 34 36 34 30 36 28 30 31 30 -1 -64 0 11 8 4 0 4 0 1 1 17 0 -1 -60 0 31 0 0 1 5 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 -1 -60 0 -75 16 0 2 1 3 3 2 4 3 5 5
4 4 0 0 1 125 1 2 3 0 4 17 5 18 33 49 65 6 19 81 97 7 34 113 20 50 -127 -111 -95 8 35 66 -79 -63 21 82 -47 -16 36 51 98 114 -126 9 10 22 23 24 25 26 37 38 39 40 41 42 52 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104
105 106 115 116 117 118 119 120 121 122 -125 -124 -123 -122 -121 -120 -119 -118 -110 -109 -108 -107 -106 -105 -104 -103 -102 -94 -93 -92 -91 -90 -89 -88 -87 -86 -78 -77 -76 -75 -74 -73 -72 -71 -70 -62 -61 -60 -59 -58 -57 -56 -55 -54 -46 -45 -44 -43 -42 -41
-40 -39 -38 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -1 -38 0 8 1 1 0 0 63 0 -93 12 85 114 24 -86 -20 49 85 -40 98 -85 -80 -59 87 97 -118 -82 67 21 93 -122 42 -69 12 85 118 24 -86 -20 49 85 -56 98 -85 -80 -59 87 97 -118 -82
-61 21 93 -122 42 -71 12 85 -14 -49 -19 121 -5 70 -1 0 -62 63 -10 -49 -121 -97 15 47 -1 0 -30 117 -52 58 -74 -83 3 -1 0 -57 -113 102 -126 22 31 -14 -37 -77 56 -1 0 87 -48 126 -13 38 63 -119 97 -118 -82 -61 21 93 -122 42 -69 12 85 118 24 -86 -28 49 85 -40 98
-85 -80 -59 87 97 -118 -82 -61 21 92 -122 42 -69 12 85 118 24 -86 -20 49 85 -40 98 -85 -112 -59 87 97 -118 -82 -61 21 93 -122 42 -69 12 85 114 24 -86 -20 49 85 -40 98 -85 -80 -59 87 97 -118 -82 67 21 93 -122 42 13SIM1:image1:ArrayData 2020-01-24 16:16:12.352025 500 -1 -40 -1 -32 0 16 74 70 73 70 0 1 1 0 0 1 0 1 0 0 -1 -37 0 67 0 5 3 4 4 4 3 5 4 4 4 5 5 5 6 7 12 8 7 7 7 7 15 11 11 9
12 17 15 18 18 17 15 17 17 19 22 28 23 19 20 26 21 17 17 24 33 24 26 29 29 31 31 31 19 23 34 36 34 30 36 28 30 31 30 -1 -64 0 11 8 4 0 4 0 1 1 17 0 -1 -60 0 31 0 0 1 5 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 -1 -60 0 -75 16 0 2 1 3 3 2 4 3 5 5
4 4 0 0 1 125 1 2 3 0 4 17 5 18 33 49 65 6 19 81 97 7 34 113 20 50 -127 -111 -95 8 35 66 -79 -63 21 82 -47 -16 36 51 98 114 -126 9 10 22 23 24 25 26 37 38 39 40 41 42 52 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104
105 106 115 116 117 118 119 120 121 122 -125 -124 -123 -122 -121 -120 -119 -118 -110 -109 -108 -107 -106 -105 -104 -103 -102 -94 -93 -92 -91 -90 -89 -88 -87 -86 -78 -77 -76 -75 -74 -73 -72 -71 -70 -62 -61 -60 -59 -58 -57 -56 -55 -54 -46 -45 -44 -43 -42 -41
-40 -39 -38 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -1 -38 0 8 1 1 0 0 63 0 -91 12 85 118 24 -86 -20 49 85 -40 98 -85 -112 -59 87 97 -118 -82 -61 21 93 -122 42 -69 12 85 114 24 -86 -20 49 85 -40 98 -85 -80 -59 87 97 -118
-82 67 21 93 -122 42 -69 12 85 -15 47 -19 121 -5 70 -1 0 -62 65 -10 -49 -121 -97 15 47 -1 0 -30 75 -52 58 -74 -83 3 -1 0 -57 -9 102 -126 22 31 -14 -57 -77 56 -1 0 89 -48 126 -17 38 79 -106 97 -118 -82 -61 21 93 -122 42 -71 12 85 118 24 -86 -20 49 85 -40 98
-85 -80 -59 87 33 -118 -82 -61 21 93 -122 42 -69 12 85 118 24 -86 -28 49 85 -40 98 -85 -80 -59 87 97 -118 -82 -61 21 92 -122 42 -69 12 85 118 24 -86 -20 49 85 -40 98 -85 -112 -59 87 97 -118 -82 -61 21 93 -122 42 13SIM1:image1:ArrayData 2020-01-24 16:16:12.450525 500 -1 -40 -1 -32 0 16 74 70 73 70 0 1 1 0 0 1 0 1 0 0 -1 -37 0 67 0 5 3 4 4 4 3 5 4 4 4 5 5 5 6 7 12 8 7 7 7 7 15 11 11 9
12 17 15 18 18 17 15 17 17 19 22 28 23 19 20 26 21 17 17 24 33 24 26 29 29 31 31 31 19 23 34 36 34 30 36 28 30 31 30 -1 -64 0 11 8 4 0 4 0 1 1 17 0 -1 -60 0 31 0 0 1 5 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 -1 -60 0 -75 16 0 2 1 3 3 2 4 3 5 5
4 4 0 0 1 125 1 2 3 0 4 17 5 18 33 49 65 6 19 81 97 7 34 113 20 50 -127 -111 -95 8 35 66 -79 -63 21 82 -47 -16 36 51 98 114 -126 9 10 22 23 24 25 26 37 38 39 40 41 42 52 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104
105 106 115 116 117 118 119 120 121 122 -125 -124 -123 -122 -121 -120 -119 -118 -110 -109 -108 -107 -106 -105 -104 -103 -102 -94 -93 -92 -91 -90 -89 -88 -87 -86 -78 -77 -76 -75 -74 -73 -72 -71 -70 -62 -61 -60 -59 -58 -57 -56 -55 -54 -46 -45 -44 -43 -42 -41
-40 -39 -38 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -1 -38 0 8 1 1 0 0 63 0 -87 12 85 118 24 -86 -28 49 85 -40 98 -85 -80 -59 87 97 -118 -82 -61 21 92 -122 42 -69 12 85 118 24 -86 -20 49 85 -40 98 -85 -112 -59 87 97 -118
-82 -61 21 93 -122 42 -102 -26 123 91 11 25 -17 -17 -18 97 -75 -76 -74 -119 -90 -98 121 -92 9 28 72 -93 44 -20 -57 -123 80 1 36 -98 0 21 -7 -1 0 -5 87 126 -48 87 95 19 47 -92 -16 -81 -123 101 -102 -41 -63 -106 -46 -115 -52 65 73 53 71 83 -111 36 -128 -14 -79
2 1 72 -49 57 1 -40 110 -38 -79 -8 52 49 85 -56 98 -85 -80 -59 87 97 -118 -82 -61 21 93 -122 42 -71 12 85 118 24 -86 -20 49 85 -40 98 -85 -80 -59 87 33 -118 -82 -61 21 93 -122 42 -69 12 85 118 24 -86 -28 49 85 -40 I believe these data make sense as the start of a JPEG image. The first 2 bytes of each array are -1 -40 which is hex FF D8. According to Wikipedia (https://en.wikipedia.org/wiki/JPEG#Syntax_and_structure)
FF D8 is JPEG “Start Of Image”, which makes sense for the first 2 bytes in stream. The changes are on the master branch on Github. Mark |