Skip to content

Commit d779fe2

Browse files
committed
wrap ImageBuilding::Build2
1 parent 2298e51 commit d779fe2

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

include/IntersonArrayCxxImagingContainer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ class IntersonArrayCxx_EXPORT Container
118118

119119
void SetHWControls(IntersonArrayCxx::Controls::HWControls * controls);
120120

121+
void Build2D(PixelType * bmode_bytedata, PixelType * image_out);
122+
121123
private:
122124

123125
Container( const Container &);

src/IntersonArrayCxxImagingContainer.cxx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ limitations under the License.
2828
#include <msclr/auto_gcroot.h>
2929

3030
#using "IntersonArray.dll"
31+
#using "System.Drawing.dll"
3132

3233
#pragma managed
3334

@@ -332,8 +333,39 @@ class ContainerImpl
332333
{
333334
this->hwControls = controls;
334335
}
336+
void Build2D(Container::PixelType * bmode_bytedata, Container::PixelType * image_out) {
337+
ContainerImpl::ArrayType^ bmode_bytedata_array =
338+
gcnew ArrayType( Container::NBOFLINES, Container::MAX_SAMPLES );
335339

336-
//
340+
for ( int ii = 0; ii < Container::NBOFLINES; ++ii )
341+
{
342+
for ( int jj = 0; jj < Container::MAX_SAMPLES; ++jj )
343+
{
344+
bmode_bytedata_array[ii, jj] =
345+
bmode_bytedata[Container::MAX_SAMPLES * ii + jj];
346+
}
347+
}
348+
349+
System::Drawing::Bitmap^ image =
350+
gcnew System::Drawing::Bitmap(512, 512, System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
351+
WrappedImageBuilding->Build2D(image, bmode_bytedata_array, bmode_bytedata_array, WrappedScanConverter.get());
352+
System::Drawing::Imaging::BitmapData^ bmpData = image->LockBits(System::Drawing::Rectangle(0, 0, 512, 512),
353+
System::Drawing::Imaging::ImageLockMode::ReadOnly,
354+
System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
355+
356+
char* row = (char*) reinterpret_cast<char*>(bmpData->Scan0.ToPointer());
357+
for ( int ii = 0; ii < 512; ++ii )
358+
{
359+
for ( int jj = 0; jj < 512; ++jj )
360+
{
361+
image_out[512 * ii + jj] = row[jj];
362+
}
363+
row += bmpData->Stride;
364+
}
365+
366+
}
367+
368+
//
337369
// Begin Wrapped ImageBuilding
338370
//
339371

@@ -557,6 +589,13 @@ ::SetHWControls(IntersonArrayCxx::Controls::HWControls * controls)
557589
Impl->SetHWControls(controls);
558590
}
559591

592+
void
593+
Container
594+
::Build2D(Container::PixelType * bmode_bytedata, Container::PixelType * image_out)
595+
{
596+
Impl->Build2D(bmode_bytedata, image_out);
597+
}
598+
560599
} // end namespace Imaging
561600

562601
} // end namespace IntersonArrayCxx

0 commit comments

Comments
 (0)