Skip to content

Commit 18c2b6e

Browse files
factor out image size
1 parent d779fe2 commit 18c2b6e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/IntersonArrayCxxImagingContainer.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ class ContainerImpl
336336
void Build2D(Container::PixelType * bmode_bytedata, Container::PixelType * image_out) {
337337
ContainerImpl::ArrayType^ bmode_bytedata_array =
338338
gcnew ArrayType( Container::NBOFLINES, Container::MAX_SAMPLES );
339+
340+
int IMAGE_SIZE = 512; // This should be a parameter, however I am working on setting Image Scaling first
339341

340342
for ( int ii = 0; ii < Container::NBOFLINES; ++ii )
341343
{
@@ -347,18 +349,18 @@ class ContainerImpl
347349
}
348350

349351
System::Drawing::Bitmap^ image =
350-
gcnew System::Drawing::Bitmap(512, 512, System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
352+
gcnew System::Drawing::Bitmap(IMAGE_SIZE, IMAGE_SIZE, System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
351353
WrappedImageBuilding->Build2D(image, bmode_bytedata_array, bmode_bytedata_array, WrappedScanConverter.get());
352354
System::Drawing::Imaging::BitmapData^ bmpData = image->LockBits(System::Drawing::Rectangle(0, 0, 512, 512),
353355
System::Drawing::Imaging::ImageLockMode::ReadOnly,
354356
System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
355357

356358
char* row = (char*) reinterpret_cast<char*>(bmpData->Scan0.ToPointer());
357-
for ( int ii = 0; ii < 512; ++ii )
359+
for ( int ii = 0; ii < IMAGE_SIZE; ++ii )
358360
{
359-
for ( int jj = 0; jj < 512; ++jj )
361+
for ( int jj = 0; jj < IMAGE_SIZE; ++jj )
360362
{
361-
image_out[512 * ii + jj] = row[jj];
363+
image_out[IMAGE_SIZE * ii + jj] = row[jj];
362364
}
363365
row += bmpData->Stride;
364366
}

0 commit comments

Comments
 (0)